本文整理汇总了PHP中wp_get_attachment_url函数的典型用法代码示例。如果您正苦于以下问题:PHP wp_get_attachment_url函数的具体用法?PHP wp_get_attachment_url怎么用?PHP wp_get_attachment_url使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了wp_get_attachment_url函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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>';
}
示例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;
}
示例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;
}
示例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;
}
示例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);
}
示例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;
}
示例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);
}
示例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;
}
示例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);
}
示例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);
}
示例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;
}
示例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;
}
示例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;
}
}
示例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;
}
示例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>";
}