• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP wp_get_attachment_url函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中wp_get_attachment_url函数的典型用法代码示例。如果您正苦于以下问题:PHP wp_get_attachment_url函数的具体用法?PHP wp_get_attachment_url怎么用?PHP wp_get_attachment_url使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了wp_get_attachment_url函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: cap_podcast_player

/**
* We're going to override the_content through a filter.
*/
function cap_podcast_player($id = null, $player_type = 'default')
{
    if (empty($id)) {
        $post_id = get_the_ID();
    } else {
        $post_id = $id;
    }
    $episode_number = get_post_meta($post_id, 'episode_number', true);
    // Get Episode Media Source
    $episode_attachment_id = get_post_meta($post_id, 'episode_file', true);
    $episode_external_file = get_post_meta($post_id, 'external_episode_file', true);
    if (!empty($episode_attachment_id)) {
        $player_src = wp_get_attachment_url($episode_attachment_id);
    } elseif (!empty($episode_external_file)) {
        $player_src = $episode_external_file;
    }
    $attr = array('src' => '' . $player_src . '', 'loop' => '', 'autoplay' => '', 'preload' => 'metadata');
    $player = wp_audio_shortcode($attr);
    $download_link = '<small><a href="' . $player_src . '" download="episode' . $episode_number . '.mp3">Download this Episode</a></small>';
    // Get Episode Artwork //
    $episode_artwork_id = get_post_thumbnail_id($post_id);
    $episode_artwork = wp_get_attachment_image_src($episode_artwork_id, 'cap-podcast-thumbnail');
    $episode_artwork_src = $episode_artwork[0];
    if ('default' == $player_type) {
        $episode_title = '
        <div class="episode-info">
            <h4>Episode #' . $episode_number . '</h4>
            <h2>' . get_the_title($post_id) . '</h2>
        </div>
        ';
    } elseif ('large' == $player_type) {
        $post_object = get_post($post_id);
        $episode_title = '
        <a href="' . get_permalink($post_id) . '" class="episode-info">
            <h4>Episode #' . $episode_number . '</h4>
            <h2>' . get_the_title($post_id) . '</h2>
            <span class="description">' . wp_trim_words($post_object->post_content, '60') . '</span>
        </a>
        ';
    } elseif ('mini' == $player_type) {
        $episode_title = '';
    }
    // Construct Markup
    $markup = '
    <div class="episode-header">
        <div class="episode-artwork-container">
            <div class="episode-artwork" style="background-image: url(' . $episode_artwork_src . ');">
                <div id="play-episode" class="maintain-ratio">
                    <span class="dashicons"></span>
                </div>
            </div>
        </div>
        ' . $episode_title . '
    </div>';
    $script = "\n    <script type='text/javascript'>\n    var playerID = jQuery('#episode-" . $episode_number . "-" . $post_id . " audio').attr('id');\n    var player" . $post_id . " = document.getElementById(playerID);\n    jQuery('#episode-" . $episode_number . "-" . $post_id . " #play-episode').click(function(){\n        jQuery('#episode-" . $episode_number . "-" . $post_id . " #play-episode .dashicons').toggleClass('paused');\n    });\n\n    jQuery('#episode-" . $episode_number . "-" . $post_id . " #play-episode').click(function() {\n\n        if ( jQuery('#episode-" . $episode_number . "-" . $post_id . " #play-episode .dashicons').hasClass('paused') ) {\n            player" . $post_id . ".play();\n        }\n\n        if ( !jQuery('#episode-" . $episode_number . "-" . $post_id . " #play-episode .dashicons').hasClass('paused') ) {\n            player" . $post_id . ".pause();\n        }\n\n    });\n    </script>\n    ";
    if (function_exists('cap_podcast_player_colors')) {
        $player .= cap_podcast_player_colors($post_id);
    }
    return '<div id="episode-' . $episode_number . '-' . $post_id . '" class="podcast-player ' . $player_type . '">' . $markup . $player . $download_link . $script . '</div>';
}
开发者ID:amprog,项目名称:cap-podcaster,代码行数:63,代码来源:single-episode-template.php


示例2: curly_person

function curly_person($atts, $content = null)
{
    extract(shortcode_atts(array('style' => null, 'picture' => null, 'name' => null, 'facebook' => null, 'twitter' => null, 'linkedin' => null, 'position' => null, 'email' => null), $atts));
    $html = '<div class="person clearfix ' . ($style ? $style : null) . '">';
    $style = is_null($style) ? 'normal' : $style;
    $picture = is_numeric($picture) ? wp_get_attachment_url($picture) : $picture;
    $content = function_exists('wpb_js_remove_wpautop') ? wpb_js_remove_wpautop($content, true) : $content;
    if ($style) {
        if ($style == 'mini') {
            $html .= $picture ? '<img src="' . $picture . '" alt="' . $name . '">' : null;
            $html .= '<div>';
            $html .= $name ? '<strong>' . $name . '</strong><br>' : null;
            $html .= $position ? $position . '<br>' : null;
            $html .= $content ? apply_filters('the_content', $content) : null;
            $html .= '</div>';
        } else {
            $html .= $picture ? '<p class="text-center"><img src="' . $picture . '" alt="' . $name . '"></p>' : null;
            $html .= '<div class="text-center">';
            $html .= $name ? '<h5>' . $name . '</h5>' : null;
            $html .= $position ? $position . '<br><br>' : null;
            $html .= $content ? '<p>' . apply_filters('the_content', $content) . '</p>' : null;
            $html .= $facebook || $twitter || $linkedin || $email ? '<p>' : null;
            $html .= $facebook ? '<a href="' . $facebook . '">' . do_shortcode('[icon icon="facebook" boxed="yes"]') . '</a> ' : null;
            $html .= $twitter ? '<a href="' . $twitter . '">' . do_shortcode('[icon icon="twitter" boxed="yes"]') . '</a> ' : null;
            $html .= $linkedin ? '<a href="' . $linkedin . '">' . do_shortcode('[icon icon="linkedin" boxed="yes"]') . '</a> ' : null;
            $html .= $email ? '<a href="mailto:' . $email . '">' . do_shortcode('[icon icon="envelope" boxed="yes"]') . '</a> ' : null;
            $html .= $facebook || $twitter || $linkedin || $email ? '</p>' : null;
            $html .= '</div>';
        }
    }
    $html .= '</div>';
    return $html;
}
开发者ID:raducretu,项目名称:curly-extension,代码行数:33,代码来源:person.php


示例3: get_template_variables

 function get_template_variables($instance, $args)
 {
     static $player_id = 1;
     $poster = '';
     $video_host = $instance['host_type'];
     if ($video_host == 'self') {
         if (!empty($instance['video']['self_video'])) {
             // Handle an attachment video
             $src = wp_get_attachment_url($instance['video']['self_video']);
             $vid_info = wp_get_attachment_metadata($instance['video']['self_video']);
             $video_type = 'video/' . empty($vid_info['fileformat']) ? '' : $vid_info['fileformat'];
         } else {
             if (!empty($instance['video']['self_video_fallback'])) {
                 // Handle an external URL video
                 $src = $instance['video']['self_video_fallback'];
                 $vid_info = wp_check_filetype(basename($instance['video']['self_video_fallback']));
                 $video_type = $vid_info['type'];
             }
         }
         $poster = !empty($instance['video']['self_poster']) ? wp_get_attachment_url($instance['video']['self_poster']) : '';
     } else {
         $video_host = $this->get_host_from_url($instance['video']['external_video']);
         $video_type = 'video/' . $video_host;
         $src = !empty($instance['video']['external_video']) ? $instance['video']['external_video'] : '';
     }
     $return = array('player_id' => 'sow-player-' . $player_id++, 'host_type' => $instance['host_type'], 'src' => $src, 'video_type' => $video_type, 'is_skinnable_video_host' => $this->is_skinnable_video_host($video_host), 'poster' => $poster, 'autoplay' => !empty($instance['playback']['autoplay']), 'skin_class' => 'default');
     // Force oEmbed for this video
     if ($instance['host_type'] == 'external' && $instance['playback']['oembed']) {
         $return['is_skinnable_video_host'] = false;
     }
     return $return;
 }
开发者ID:MichaelEniolade,项目名称:MechrisPlanetWebsite,代码行数:32,代码来源:so-video-widget.php


示例4: banner_simple_height

function banner_simple_height($params = array(), $content = null)
{
    extract(shortcode_atts(array('title' => 'Freeshipping on all order over $75', 'subtitle' => 'Shop Now', 'link_url' => '', 'title_color' => '#fff', 'subtitle_color' => '#fff', 'inner_stroke' => '0px', 'inner_stroke_color' => '#fff', 'bg_color' => '#000', 'bg_image' => '', 'height' => 'auto', 'sep_padding' => '5px', 'sep_color' => 'rgba(255,255,255,0.01)', 'with_bullet' => 'no', 'bullet_text' => 'Bullet Text Goes Here', 'bullet_bg_color' => '', 'bullet_text_color' => ''), $params));
    $banner_with_img = '';
    if (is_numeric($bg_image)) {
        $bg_image = wp_get_attachment_url($bg_image);
        $banner_with_img = 'banner_with_img';
    }
    $content = do_shortcode($content);
    $banner_simple_height = '
		<div class="shortcode_banner_simple_height ' . $banner_with_img . '" onclick="location.href=\'' . $link_url . '\';">
			<div class="shortcode_banner_simple_height_inner">
				<div class="shortcode_banner_simple_height_bkg" style="background-color:' . $bg_color . '; background-image:url(' . $bg_image . ')"></div>
			
				<div class="shortcode_banner_simple_height_inside" style="height:' . $height . '; border: ' . $inner_stroke . ' solid ' . $inner_stroke_color . '">
					<div class="shortcode_banner_simple_height_content">
						<div><h3 style="color:' . $title_color . ' !important">' . $title . '</h3></div>
						<div class="shortcode_banner_simple_height_sep" style="margin:' . $sep_padding . ' auto; background-color:' . $sep_color . ';"></div>
						<div><h4 style="color:' . $subtitle_color . ' !important">' . $subtitle . '</h4></div>
					</div>
				</div>
			</div>';
    if ($with_bullet == 'yes') {
        $banner_simple_height .= '<div class="shortcode_banner_simple_height_bullet" style="background:' . $bullet_bg_color . '; color:' . $bullet_text_color . '"><span>' . $bullet_text . '</span></div>';
    }
    $banner_simple_height .= '</div>';
    return $banner_simple_height;
}
开发者ID:renatodex,项目名称:submundo-blogstore,代码行数:28,代码来源:banner.php


示例5: get_data

 /**
  * Compile the schema.org event data into an array
  */
 public function get_data($post = null, $args = array())
 {
     if (!$post instanceof WP_Post) {
         $post = Tribe__Main::post_id_helper($post);
     }
     $post = get_post($post);
     if (!$post instanceof WP_Post) {
         return array();
     }
     $data = (object) array();
     // We may need to prevent the context to be triggered
     if (!isset($args['context']) || false !== $args['context']) {
         $data->{'@context'} = 'http://schema.org';
     }
     $data->{'@type'} = $this->type;
     $data->name = esc_js(get_the_title($post));
     $data->description = esc_js(tribe_events_get_the_excerpt($post));
     if (has_post_thumbnail($post)) {
         $data->image = wp_get_attachment_url(get_post_thumbnail_id($post));
     }
     $data->url = esc_url_raw(get_permalink($post));
     // Index by ID: this will allow filter code to identify the actual event being referred to
     // without injecting an additional property
     return array($post->ID => $data);
 }
开发者ID:nullify005,项目名称:shcc-website,代码行数:28,代码来源:Abstract.php


示例6: build_data

 /**
  * Compile the schema.org event data into an array
  */
 private function build_data()
 {
     global $post;
     $id = $post->ID;
     $events_data = array();
     // Index by ID: this will allow filter code to identify the actual event being referred to
     // without injecting an additional property
     $events_data[$id] = new stdClass();
     $events_data[$id]->{'@context'} = 'http://schema.org';
     $events_data[$id]->{'@type'} = 'Event';
     $events_data[$id]->name = get_the_title();
     if (has_post_thumbnail()) {
         $events_data[$id]->image = wp_get_attachment_url(get_post_thumbnail_id($post->ID));
     }
     $events_data[$id]->url = get_the_permalink($post->ID);
     $events_data[$id]->startDate = get_gmt_from_date(tribe_get_start_date($post, true, TribeDateUtils::DBDATETIMEFORMAT), 'c');
     $events_data[$id]->endDate = get_gmt_from_date(tribe_get_end_date($post, true, TribeDateUtils::DBDATETIMEFORMAT), 'c');
     if (tribe_has_venue($id)) {
         $events_data[$id]->location = new stdClass();
         $events_data[$id]->location->{'@type'} = 'Place';
         $events_data[$id]->location->name = tribe_get_venue($post->ID);
         $events_data[$id]->location->address = strip_tags(str_replace("\n", '', tribe_get_full_address($post->ID)));
     }
     /**
      * Allows the event data to be modifed by themes and other plugins.
      *
      * @param array $events_data objects representing the Google Markup for each event.
      */
     $events_data = apply_filters('tribe_google_event_data', $events_data);
     // Strip the post ID indexing before returning
     $events_data = array_values($events_data);
     return $events_data;
 }
开发者ID:chicosilva,项目名称:olharambiental,代码行数:36,代码来源:Google_Data_Markup.php


示例7: test__valid_attachment_and_dimensions

 function test__valid_attachment_and_dimensions()
 {
     $source = wp_get_attachment_url($this->_attachment_id);
     $expected = array(498, 113);
     $dimensions = AMP_Image_Dimension_Extractor::extract_from_attachment_metadata(false, $source);
     $this->assertEquals($expected, $dimensions);
 }
开发者ID:joedooley,项目名称:amp-wp,代码行数:7,代码来源:test-amp-image-dimension-extractor.php


示例8: dtwl_woo_get_product_first_thumbnail

 function dtwl_woo_get_product_first_thumbnail($size = 'shop_catalog', $deprecated1 = 0, $deprecated2 = 0)
 {
     global $post, $product;
     $html = '';
     $attachment_ids = $product->get_gallery_attachment_ids();
     $i = 0;
     if ($attachment_ids) {
         $i++;
         foreach ($attachment_ids as $attachment_id) {
             $image_link = wp_get_attachment_url($attachment_id);
             if (!$image_link) {
                 continue;
             }
             $image_title = esc_attr(get_the_title($attachment_id));
             $image = wp_get_attachment_image($attachment_id, apply_filters('single_product_small_thumbnail_size', $size), 0, $attr = array('title' => $image_title, 'alt' => $image_title));
             $html = '<div class="dtwl-woo-product-thumbnail dtwl-woo-product-back-thumbnail">';
             $html .= $image;
             $html .= '</div>';
             if ($i == 1) {
                 break;
             }
         }
     }
     return $html;
 }
开发者ID:dawnthemes,项目名称:dtwl,代码行数:25,代码来源:dt-template-functions.php


示例9: prepare_item_for_response

 /**
  * Prepare a single product category output for response.
  *
  * @param WP_Term $item Term object.
  * @param WP_REST_Request $request
  * @return WP_REST_Response $response
  */
 public function prepare_item_for_response($item, $request)
 {
     // Get category display type.
     $display_type = get_woocommerce_term_meta($item->term_id, 'display_type');
     // Get category order.
     $menu_order = get_woocommerce_term_meta($item->term_id, 'order');
     $data = array('id' => (int) $item->term_id, 'name' => $item->name, 'slug' => $item->slug, 'parent' => (int) $item->parent, 'description' => $item->description, 'display' => $display_type ? $display_type : 'default', 'image' => array(), 'menu_order' => (int) $menu_order, 'count' => (int) $item->count);
     // Get category image.
     if ($image_id = get_woocommerce_term_meta($item->term_id, 'thumbnail_id')) {
         $attachment = get_post($image_id);
         $data['image'] = array('id' => (int) $image_id, 'date_created' => wc_rest_prepare_date_response($attachment->post_date_gmt), 'date_modified' => wc_rest_prepare_date_response($attachment->post_modified_gmt), 'src' => wp_get_attachment_url($image_id), 'title' => get_the_title($attachment), 'alt' => get_post_meta($image_id, '_wp_attachment_image_alt', true));
     }
     $context = !empty($request['context']) ? $request['context'] : 'view';
     $data = $this->add_additional_fields_to_object($data, $request);
     $data = $this->filter_response_by_context($data, $context);
     $response = rest_ensure_response($data);
     $response->add_links($this->prepare_links($item, $request));
     /**
      * Filter a term item returned from the API.
      *
      * Allows modification of the term data right before it is returned.
      *
      * @param WP_REST_Response  $response  The response object.
      * @param object            $item      The original term object.
      * @param WP_REST_Request   $request   Request used to generate the response.
      */
     return apply_filters("woocommerce_rest_prepare_{$this->taxonomy}", $response, $item, $request);
 }
开发者ID:jesusmarket,项目名称:jesusmarket,代码行数:35,代码来源:class-wc-rest-product-categories-controller.php


示例10: prepare_post

 /**
  * Get attachment-specific data
  *
  * @param array $post
  * @return array
  */
 protected function prepare_post($post, $context = 'single')
 {
     $data = parent::prepare_post($post, $context);
     if (is_wp_error($data) || $post['post_type'] !== 'attachment') {
         return $data;
     }
     // $thumbnail_size = current_theme_supports( 'post-thumbnail' ) ? 'post-thumbnail' : 'thumbnail';
     $data['source'] = wp_get_attachment_url($post['ID']);
     $data['is_image'] = wp_attachment_is_image($post['ID']);
     $data['attachment_meta'] = wp_get_attachment_metadata($post['ID']);
     // Ensure empty meta is an empty object
     if (empty($data['attachment_meta'])) {
         $data['attachment_meta'] = new stdClass();
     } elseif (!empty($data['attachment_meta']['sizes'])) {
         $img_url_basename = wp_basename($data['source']);
         foreach ($data['attachment_meta']['sizes'] as $size => &$size_data) {
             // Use the same method image_downsize() does
             $size_data['url'] = str_replace($img_url_basename, $size_data['file'], $data['source']);
         }
     } else {
         $data['attachment_meta']['sizes'] = new stdClass();
     }
     // Override entity meta keys with the correct links
     $data['meta'] = array('links' => array('self' => json_url('/media/' . $post['ID']), 'author' => json_url('/users/' . $post['post_author']), 'collection' => json_url('/media'), 'replies' => json_url('/media/' . $post['ID'] . '/comments'), 'version-history' => json_url('/media/' . $post['ID'] . '/revisions')));
     if (!empty($post['post_parent'])) {
         $data['meta']['links']['up'] = json_url('/media/' . (int) $post['post_parent']);
     }
     return apply_filters('json_prepare_attachment', $data, $post, $context);
 }
开发者ID:dani-ocean,项目名称:wp_angular_api,代码行数:35,代码来源:class-wp-json-media.php


示例11: blox_shortcode

function blox_shortcode($attributes, $content)
{
    extract(shortcode_atts(array("img" => '', "height" => '', 'padding_top' => 0, 'padding_bottom' => 0, 'bg_attachment' => 'false', 'bg_position' => 'center center', 'bgcover' => 'true', 'repeat' => 'no-repeat', 'dark' => 'false', 'class' => '', 'bgcolor' => '', 'row_pattern' => '', 'row_color' => '', 'id' => ''), $attributes));
    if (is_numeric($img)) {
        $img = wp_get_attachment_url($img);
    }
    $fixed = $bg_attachment == 'true' ? 'fixed' : '';
    $background_style = !empty($img) ? " background: url('{$img}') {$repeat} {$fixed}; background-position: {$bg_position};" : '';
    $background_size = $bgcover == 'true' ? 'background-size: cover;' : '';
    $w_height = ltrim($height);
    if (substr($w_height, -2, 2) == "px") {
        $height_style = " min-height:{$w_height}; ";
    } else {
        $height_style = " min-height:{$w_height}px; ";
    }
    $padding_top = ltrim($padding_top);
    $padding_top = substr($padding_top, -2, 2) == "px" ? $padding_top : $padding_top . 'px';
    $padding_bottom = ltrim($padding_bottom);
    $padding_bottom = substr($padding_bottom, -2, 2) == "px" ? $padding_bottom : $padding_bottom . 'px';
    $padding_style = " padding-top:{$padding_top}; padding-bottom:{$padding_bottom}; ";
    if (!empty($bgcolor)) {
        $bgcolor = ' background-color:' . $bgcolor . ';';
    }
    $is_dark = 'true' == $dark ? ' dark ' : '';
    $color_overlay = 'background-color:' . $row_color;
    if (!empty($id)) {
        $out = '</div></section><section id="' . $id . '" class="blox ' . $is_dark . $class . ' ' . $row_pattern . '" style="' . $padding_style . $background_style . $background_size . $height_style . $bgcolor . '"><div class="max-overlay" style="' . $color_overlay . '"></div><div class="wpb_row vc_row-fluid full-row"><div class="container">';
    } else {
        $out = '</div></section><section class="blox ' . $is_dark . $class . ' ' . $row_pattern . '" style="' . $padding_style . $background_style . $background_size . $height_style . $bgcolor . '"><div class="max-overlay" style="' . $color_overlay . '"></div><div class="wpb_row vc_row-fluid full-row"><div class="container">';
    }
    $out .= do_shortcode($content);
    $out .= '</div></div></section><section class="container"><div class="row-wrapper-x">';
    return $out;
}
开发者ID:arkev,项目名称:IntelligentMode,代码行数:34,代码来源:blox.php


示例12: filter_image_downsize

 /**
  * Callback for the "image_downsize" filter.
  *
  * @param bool $ignore A value meant to discard unfiltered info returned from this filter.
  * @param int $attachment_id The ID of the attachment for which we want a certain size.
  * @param string $size_name The name of the size desired.
  */
 public function filter_image_downsize($ignore = false, $attachment_id = 0, $size_name = 'thumbnail')
 {
     global $_wp_additional_image_sizes;
     $attachment_id = (int) $attachment_id;
     $size_name = trim($size_name);
     $meta = wp_get_attachment_metadata($attachment_id);
     /* the requested size does not yet exist for this attachment */
     if (empty($meta['sizes']) || empty($meta['sizes'][$size_name])) {
         // let's first see if this is a registered size
         if (isset($_wp_additional_image_sizes[$size_name])) {
             $height = (int) $_wp_additional_image_sizes[$size_name]['height'];
             $width = (int) $_wp_additional_image_sizes[$size_name]['width'];
             $crop = (bool) $_wp_additional_image_sizes[$size_name]['crop'];
             // if not, see if name is of form [width]x[height] and use that to crop
         } else {
             if (preg_match('#^(\\d+)x(\\d+)$#', $size_name, $matches)) {
                 $height = (int) $matches[2];
                 $width = (int) $matches[1];
                 $crop = true;
             }
         }
         if (!empty($height) && !empty($width)) {
             $resized_path = $this->_generate_attachment($attachment_id, $width, $height, $crop);
             $fullsize_url = wp_get_attachment_url($attachment_id);
             $file_name = basename($resized_path);
             $new_url = str_replace(basename($fullsize_url), $file_name, $fullsize_url);
             if (!empty($resized_path)) {
                 $meta['sizes'][$size_name] = array('file' => $file_name, 'width' => $width, 'height' => $height);
                 wp_update_attachment_metadata($attachment_id, $meta);
                 return array($new_url, $width, $height, true);
             }
         }
     }
     return false;
 }
开发者ID:ahsaeldin,项目名称:projects,代码行数:42,代码来源:filosofo-custom-image-sizes.php


示例13: custom_columns_portfolio

function custom_columns_portfolio($column)
{
    global $post;
    switch ($column) {
        case "portfolio_image":
            if (has_post_thumbnail()) {
                $imageurl = wp_get_attachment_url(get_post_thumbnail_id($post->ID));
                ?>
            <img src="<?php 
                echo $imageurl;
                ?>
" height="120"  />
			<?php 
            }
            break;
        case "pcategories":
            $pcategories = get_the_terms(0, "portfolios");
            $pcategories_html = array();
            if ($pcategories) {
                foreach ($pcategories as $pcategory) {
                    array_push($pcategories_html, $pcategory->name);
                }
                echo implode($pcategories_html, ", ");
            }
            break;
    }
}
开发者ID:Karpec,项目名称:geo-mac,代码行数:27,代码来源:portfolio.php


示例14: flagShowSkin_video_default

function flagShowSkin_video_default($args)
{
    extract($args);
    $flag_options = get_option('flag_options');
    $skinID = 'id_' . mt_rand();
    // look up for the path
    $playlistpath = ABSPATH . $flag_options['galleryPath'] . 'playlists/video/' . $playlist . '.xml';
    $data = file_get_contents($playlistpath);
    $flashBackcolor = flagGetBetween($data, '<property1>0x', '</property1>');
    if (empty($width)) {
        $width = flagGetBetween($data, '<width><![CDATA[', ']]></width>');
    }
    if (empty($height)) {
        $height = flagGetBetween($data, '<height><![CDATA[', ']]></height>');
    }
    if (empty($wmode)) {
        $wmode = flagGetBetween($data, '<property0><![CDATA[', ']]></property0>');
    }
    if (empty($flashBackcolor)) {
        $flashBackcolor = $flag_options['flashBackcolor'];
    }
    require_once FLAG_ABSPATH . 'admin/video.functions.php';
    $playlist_data = get_v_playlist_data($playlistpath);
    $alternative = '';
    if (count($playlist_data['items'])) {
        foreach ($playlist_data['items'] as $id) {
            $videoObject = get_post($id);
            $url = wp_get_attachment_url($videoObject->ID);
            $thumb = get_post_meta($videoObject->ID, 'thumbnail', true);
            $aimg = $thumb ? '<img src="' . $thumb . '" style="float:left;margin-right:10px;width:150px;height:auto;" alt="" />' : '';
            $atitle = $videoObject->post_title ? '<strong>' . $videoObject->post_title . '</strong>' : '';
            $acontent = $videoObject->post_content ? '<div style="padding:4px 0;">' . $videoObject->post_content . '</div>' : '';
            $alternative .= '<div id="video_' . $videoObject->ID . '" style="overflow:hidden;padding:7px 0;">' . $aimg . $atitle . $acontent . '<div style="font-size:80%;">This browser does not support flv files! You can <a href="' . $url . '">download the video</a> instead.</div></div>';
        }
    }
    // init the flash output
    $swfobject = new flag_swfobject($flag_options['skinsDirURL'] . $skin . '/gallery.swf', $skinID, $width, $height, '10.1.52', plugins_url('/' . FLAGFOLDER . '/') . 'skins/expressInstall.swf');
    global $swfCounter;
    $swfobject->add_params('wmode', $wmode);
    $swfobject->add_params('allowfullscreen', 'true');
    $swfobject->add_params('allowScriptAccess', 'always');
    $swfobject->add_params('saling', 'lt');
    $swfobject->add_params('scale', 'noScale');
    $swfobject->add_params('menu', 'false');
    $swfobject->add_params('bgcolor', '#' . $flashBackcolor);
    $swfobject->add_attributes('id', $skinID);
    $swfobject->add_attributes('name', $skinID);
    // adding the flash parameter
    $swfobject->add_flashvars('path', $flag_options['skinsDirURL'] . $skin . '/');
    $swfobject->add_flashvars('skinID', $skinID);
    $swfobject->add_flashvars('playlist', $playlist);
    // create the output
    $out = '<div class="grandvideo">' . $swfobject->output($alternative) . '</div>';
    // add now the script code
    $out .= '<script type="text/javascript" defer="defer">';
    $out .= $swfobject->javascript();
    $out .= '</script>';
    $out = apply_filters('flag_show_flash_v_content', $out);
    return $out;
}
开发者ID:selectSIFISO,项目名称:.comsite,代码行数:60,代码来源:video_default.php


示例15: get_value

 function get_value($id)
 {
     $paths = array();
     $meta = get_post_meta($id, '_wp_attachment_metadata', true);
     if (!isset($meta['sizes'])) {
         return $this->get_empty_char();
     }
     // available sizes
     if ($intersect = array_intersect(array_keys($meta['sizes']), get_intermediate_image_sizes())) {
         $url = wp_get_attachment_url($id);
         $filename = basename($url);
         $paths[] = "<a title='{$filename}' href='{$url}'>" . __('full size', 'codepress-admin-columns') . "</a>";
         foreach ($intersect as $size) {
             $src = wp_get_attachment_image_src($id, $size);
             if (!empty($src[0])) {
                 $filename = basename($src[0]);
                 $paths[] = "<a title='{$filename}' href='{$src[0]}' class='available'>{$size}</a>";
             }
         }
     }
     global $_wp_additional_image_sizes;
     if (!empty($_wp_additional_image_sizes)) {
         if (isset($_wp_additional_image_sizes['post-thumbnail'])) {
             unset($_wp_additional_image_sizes['post-thumbnail']);
         }
         // image does not have these additional sizes rendered yet
         if ($missing = array_diff(array_keys($_wp_additional_image_sizes), array_keys($meta['sizes']))) {
             foreach ($missing as $size) {
                 $paths[] = "<span title='Missing size: Try regenerate thumbnails with the plugin: Force Regenerate Thumbnails' href='javascript:;' class='not-available'>{$size}</span>";
             }
         }
     }
     return "<div class='sizes'>" . implode('<span class="cpac-divider"></span>', $paths) . "</div>";
 }
开发者ID:xeiter,项目名称:timeplannr,代码行数:34,代码来源:available-sizes.php


示例16: sfc_media_find_images

function sfc_media_find_images($post, $content = '')
{
    if (empty($content)) {
        $content = apply_filters('the_content', $post->post_content);
    }
    $images = array();
    // we get the post thumbnail, put it first in the image list
    if (current_theme_supports('post-thumbnails') && has_post_thumbnail($post->ID)) {
        $thumbid = get_post_thumbnail_id($post->ID);
        $att = wp_get_attachment_image_src($thumbid, 'full');
        if (!empty($att[0])) {
            $images[] = $att[0];
        }
    }
    if (is_attachment() && preg_match('!^image/!', get_post_mime_type($post))) {
        $images[] = wp_get_attachment_url($post->ID);
    }
    // now search for images in the content itself
    if (preg_match_all('/<img\\s+(.+?)>/i', $content, $matches)) {
        foreach ($matches[1] as $match) {
            foreach (wp_kses_hair($match, array('http')) as $attr) {
                $img[strtolower($attr['name'])] = $attr['value'];
            }
            if (isset($img['src'])) {
                if (!isset($img['class']) || isset($img['class']) && false === straipos($img['class'], apply_filters('sfc_img_exclude', array('wp-smiley')))) {
                    // ignore smilies
                    if (!in_array($img['src'], $images) && strpos($img['src'], 'fbcdn.net') === false && strpos($img['src'], '/plugins/') === false) {
                        $images[] = $img['src'];
                    }
                }
            }
        }
    }
    return $images;
}
开发者ID:vinvinh315,项目名称:maintainwebsolutions.com,代码行数:35,代码来源:sfc-media.php


示例17: webnus_videorow_shortcode

function webnus_videorow_shortcode($attributes, $content)
{
    extract(shortcode_atts(array("img" => '', "height" => '', 'padding_top' => 0, 'padding_bottom' => 0, 'dark' => 'false', 'class' => '', 'video_pattern' => 'true', 'id' => '', 'video_src' => 'host', 'video_sharing_url' => '', 'mp4_format' => '', 'webm_format' => '', 'ogg_format' => '', 'img_preview_video' => ''), $attributes));
    if (is_numeric($img_preview_video)) {
        $img_preview_video = wp_get_attachment_url($img_preview_video);
    }
    $height_style = $height ? ' min-height: ' . $height . 'px !important; ' : 'min-height: 380px;';
    $padding_style = " padding-top:{$padding_top}; padding-bottom:{$padding_bottom}; ";
    $id = $id ? 'id="' . $id . '"' : '';
    $spattern = $video_pattern == 'true' ? 'class="spattern"' : '';
    $out = '</div></section><section ' . $id . ' class="video-sec ' . $class . '" style="' . $padding_style . $height_style . '">';
    $out .= '<div class="wpb_row vc_row-fluid full-row">';
    $out .= '<div ' . $spattern . '>';
    if ($video_src == 'host') {
        $default_screen_video = 'class="video-item" ';
        $out .= '<video autoplay loop muted preload="auto" ' . $default_screen_video . '>';
        $out .= !empty($mp4_format) ? '<source src="' . $mp4_format . '" type="video/mp4">' : '';
        $out .= !empty($webm_format) ? '<source src="' . $webm_format . '" type="video/webm">' : '';
        $out .= !empty($ogg_format) ? '<source src="' . $ogg_format . '" type="video/ogg">' : '';
        $out .= 'Your browser does not support the video tag. I suggest you upgrade your browser.</video>';
        $out .= '<div style="position: absolute; top: 0; right: 0; bottom: 0; left: 0; background-position: 50% 50%; background-repeat: no-repeat; background-size: auto 100%; background: transparent url(' . $img_preview_video . ') 50% 50% / cover no-repeat ;"></div>';
    } elseif ($video_src == 'video_sharing') {
        $out .= '<div class="youtube-wrap"><div class="yt-player" id="' . $video_sharing_url . '"></div></div>';
        $out .= '<div style="position: absolute; top: 0; right: 0; bottom: 0; left: 0; background-position: 50% 50%; background-repeat: no-repeat; background-size: auto 100%; background: transparent url(' . $img_preview_video . ') 50% 50% / cover no-repeat ;"></div>';
        wp_enqueue_script('youtube-api');
    }
    $dark = $dark == 'true' ? ' dark ' : '';
    $out .= '<article class="slides-content ' . $dark . '">';
    $out .= '<div class="container">';
    $out .= do_shortcode($content);
    $out .= '</div></article>';
    $out .= '</div></div></section><section class="container"><div class="row-wrapper-x">';
    return $out;
}
开发者ID:arkev,项目名称:IntelligentMode,代码行数:34,代码来源:video-bg.php


示例18: get_tour_info

function get_tour_info()
{
    $tourinfo = array();
    $tour_ID = get_the_ID();
    $tour_title = get_the_title();
    $tour_feat_image_url = get_no_img_url();
    if (has_post_thumbnail()) {
        $tour_feat_image_url = wp_get_attachment_url(get_post_thumbnail_id());
    }
    $tour_excerpt = get_the_excerpt();
    $tour_post_link = get_permalink($tour_ID);
    $tour_departure = get_location_ID(get_post_meta($tour_ID, 'tour_departure', true));
    $tour_arrival = get_location_ID(get_post_meta($tour_ID, 'tour_arrival', true));
    $tour_price = get_post_meta($tour_ID, 'tour_price', true);
    $tour_price_discount = get_post_meta($tour_ID, 'tour_price_discount', true);
    $tour_start = get_post_meta($tour_ID, 'tour_start', true);
    $tour_end = get_post_meta($tour_ID, 'tour_end', true);
    $tour_days = get_post_meta($tour_ID, 'tour_days', true);
    $tourinfo['tour_ID'] = $tour_ID;
    $tourinfo['tour_title'] = $tour_title;
    $tourinfo['tour_feat_image_url'] = $tour_feat_image_url;
    $tourinfo['tour_excerpt'] = $tour_excerpt;
    $tourinfo['tour_post_link'] = $tour_post_link;
    $tourinfo['tour_departure'] = $tour_departure;
    $tourinfo['tour_arrival'] = $tour_arrival;
    $tourinfo['tour_price'] = $tour_price;
    $tourinfo['tour_price_discount'] = $tour_price_discount;
    $tourinfo['tour_start'] = $tour_start;
    $tourinfo['tour_end'] = $tour_end;
    $tourinfo['tour_days'] = $tour_days;
    return $tourinfo;
}
开发者ID:KennyNguyen88,项目名称:ndt-hangdong,代码行数:32,代码来源:functions.php


示例19: responsive_images

function responsive_images($html, $id, $alt, $title, $align, $url, $size)
{
    $url = wp_get_attachment_url($id);
    // Grab the current image URL
    $html = '<a href="' . $url . '" class="img-responsive" rel="your-rel"><img src="..." /></a>';
    return $html;
}
开发者ID:NeilToor,项目名称:i4web,代码行数:7,代码来源:custom.php


示例20: attachments


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP wp_get_audio_extensions函数代码示例发布时间:2022-05-23
下一篇:
PHP wp_get_attachment_thumb_url函数代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap