当前位置: 首页>>代码示例>>PHP>>正文


PHP MultiPostThumbnails::get_post_thumbnail_url方法代码示例

本文整理汇总了PHP中MultiPostThumbnails::get_post_thumbnail_url方法的典型用法代码示例。如果您正苦于以下问题:PHP MultiPostThumbnails::get_post_thumbnail_url方法的具体用法?PHP MultiPostThumbnails::get_post_thumbnail_url怎么用?PHP MultiPostThumbnails::get_post_thumbnail_url使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在MultiPostThumbnails的用法示例。


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

示例1: get_post_meta

            ?>
" src="<?php 
            if (class_exists('MultiPostThumbnails')) {
                echo MultiPostThumbnails::get_post_thumbnail_url('project', 'foreground-rollover-image', get_post_meta($module->ID, 'module_id', true), $display_size);
            }
            ?>
" /></div><?php 
        }
        if (get_post_meta($module->ID, 'module_size', true) == 'dual-small' || get_post_meta($module->ID, 'module_size', true) == 'dual-medium' || get_post_meta($module->ID, 'module_size', true) == 'dual-large') {
            ?>
<div class="module-background-image"><img id="background-image-<?php 
            echo get_post_meta($module->ID, 'module_id', true);
            ?>
" src="<?php 
            if (class_exists('MultiPostThumbnails')) {
                echo MultiPostThumbnails::get_post_thumbnail_url('project', 'background-rollover-image', get_post_meta($module->ID, 'module_id', true), $display_size);
            }
            ?>
" /></div><?php 
        }
        if ($block_link) {
            ?>
</a><?php 
        }
        ?>
</div>');
					<?php 
    }
}
?>
				</script>
开发者ID:easinewe,项目名称:Avec2016,代码行数:31,代码来源:template-modules.php

示例2: get_image_url

 public function get_image_url($type, $post_id, $size = null)
 {
     if (class_exists('MultiPostThumbnails')) {
         return \MultiPostThumbnails::get_post_thumbnail_url($this->id, $type, $post_id, $size);
     }
     return null;
 }
开发者ID:grantnorwood,项目名称:SBXWP,代码行数:7,代码来源:CPT.php

示例3: get_thumbnail_image_src

 /**
  * Retrieve the source of an image added through multiple post thumbnails.
  *
  * @param string $type Type of thumbnail being requested.
  * @param string $size Size of thumbnail being requested.
  *
  * @return bool|string URL of the image if available. False if not.
  */
 public function get_thumbnail_image_src($type, $size = null)
 {
     if (class_exists('MultiPostThumbnails')) {
         return MultiPostThumbnails::get_post_thumbnail_url(get_post_type(), $type, get_the_ID(), $size);
     }
     return false;
 }
开发者ID:natejacobson,项目名称:WSUWP-spine-parent-theme,代码行数:15,代码来源:theme-images.php

示例4:

                </a>         
            </div>
            <div class="col-md-2 modal-thumb-web">
                <a href="<?php 
echo MultiPostThumbnails::get_post_thumbnail_url(get_post_type(), 'seventh-image', NULL, 'secondary-featured-thumbnail');
?>
" data-lightbox="third-image">
                    <div class="modal-thumb-overlay transition-fast"></div>
                    <img width="100%" src="<?php 
echo MultiPostThumbnails::get_post_thumbnail_url(get_post_type(), 'seventh-image', NULL, 'secondary-featured-thumbnail');
?>
"/>
                </a>         
            </div>
            <div class="col-md-2 modal-thumb-web">
                <a href="<?php 
echo MultiPostThumbnails::get_post_thumbnail_url(get_post_type(), 'eighth-image', NULL, 'secondary-featured-thumbnail');
?>
" data-lightbox="third-image">
                    <div class="modal-thumb-overlay transition-fast"></div>
                    <img width="100%" src="<?php 
echo MultiPostThumbnails::get_post_thumbnail_url(get_post_type(), 'eighth-image', NULL, 'secondary-featured-thumbnail');
?>
"/>
                </a>         
            </div>
        </div>             
    </div>
    <div class="modal-bg"></div>
</div>
开发者ID:artman202,项目名称:wordpress-site,代码行数:30,代码来源:web-development-modal.php

示例5: get_queried_object_id

                <?php 
}
?>

                <?php 
if (MultiPostThumbnails::has_post_thumbnail(get_post_type(), 'image3')) {
    ?>
                <?php 
    $post_thumbnail_id = MultiPostThumbnails::get_post_thumbnail_id(get_post_type(), 'image3', get_queried_object_id());
    $post_thumbnail_post = get_post($post_thumbnail_id);
    $caption = trim(strip_tags($post_thumbnail_post->post_excerpt));
    $caption = esc_html($caption);
    ?>
                <figure class="extra-image">
                    <img src="<?php 
    echo $imgURL = MultiPostThumbnails::get_post_thumbnail_url(get_post_type(), 'image3', NULL, 'large');
    ?>
" alt="<?php 
    echo $caption;
    ?>
" />
                    <figcaption><?php 
    echo $caption;
    ?>
</figcaption>
                </figure>
                <?php 
}
?>
            </div>
开发者ID:consthauge,项目名称:verform-bouvet,代码行数:30,代码来源:template-productaccessories.php

示例6:

<?php

// https://github.com/voceconnect/multi-post-thumbnails/wiki
// Image settings
$post_image_before = '';
$post_image_after = '';
$img_url = MultiPostThumbnails::get_post_thumbnail_url(get_post_type(), 'secondary-image', null, 'full');
//get img URL
$img_width = '250';
$img_height = '71';
$figure_class = 'business-logo';
$img_attr = of_get_option('load_image') == 'false' || of_get_option('load_image') == "" ? 'src="' : 'src="//" data-src="';
// Resize & crop img
$image = $img_attr . aq_resize($img_url, $img_width, $img_height, true) . '"';
// Image markup
echo '<figure class="' . $figure_class . '">' . $post_image_before . '<img ' . $image . ' alt="' . get_the_title() . '" >' . $post_image_after . '</figure>';
开发者ID:AdrianBav,项目名称:oilandgas,代码行数:16,代码来源:tombstone-secondary-logo.php

示例7: url

?>
            </div>
            <!-- /.navbar-collapse -->
        </div>
        <!-- /.container -->
    </nav>
    
    <?php 
?>
          <!-- Page Header -->
    <!-- Set your background image for this header on the line below. -->
     <header class="intro-header" style="background-image: url('<?php 
//Get the Thumbnail URL
$success = false;
if (class_exists('MultiPostThumbnails')) {
    $src = MultiPostThumbnails::get_post_thumbnail_url(get_post_type(), 'page-header', $post->ID);
    if ($src != '') {
        $success = true;
        echo $src;
    } else {
        $success = false;
    }
}
if (has_post_thumbnail() && $success == false) {
    $src = wp_get_attachment_image_src(get_post_thumbnail_id($post->ID), array(1900, 600), false, '');
    $data = getimagesize($src[0]);
    $width = $data[0];
    $height = $data[1];
    if ($width > 1000 && $height > 500) {
        $success = true;
        echo $src[0];
开发者ID:neufrin,项目名称:neufrin-website-theme,代码行数:31,代码来源:header.php

示例8: kite_get_secondary_background_image

function kite_get_secondary_background_image($default)
{
    if (class_exists('MultiPostThumbnails')) {
        if (MultiPostThumbnails::has_post_thumbnail(get_post_type(), 'background-image')) {
            return MultiPostThumbnails::get_post_thumbnail_url(get_post_type(), 'background-image');
        } else {
            return $default;
        }
    } else {
        return $default;
    }
}
开发者ID:s4mobile,项目名称:WordPressTech,代码行数:12,代码来源:functions.php

示例9: get_final_posts

/**
 * Generate posts array
 *
 * @param $posts
 * @param $offset
 * @param $taxonomy
 * @param $eager_loading
 * @param $post_type
 * @param $final_posts
 *
 * @return mixed
 */
function get_final_posts($posts, $offset, $taxonomy, $eager_loading, $final_posts)
{
    foreach ($posts as $post) {
        $final_post = array();
        $post_id = $post->ID;
        $key = http_build_query(array('post_id' => "{$post_id}", "type" => "ml_post"));
        $cache = get_cache('ml_post', $key);
        if (!empty($cache)) {
            $final_posts["posts"][] = unserialize($cache);
            continue;
        }
        $final_post["post_id"] = "{$post_id}";
        $final_post["post_type"] = $post->post_type;
        $final_post["author"] = array();
        $final_post["categories"] = array();
        $final_post["author"]["name"] = html_entity_decode(get_author_name($post->post_author));
        $final_post["author"]["author_id"] = $post->post_author;
        $final_post["title"] = strip_tags($post->post_title);
        $final_post["title"] = html_entity_decode($final_post["title"], ENT_QUOTES);
        $final_post["videos"] = array();
        $final_post["images"] = array();
        if ($offset > 0 && is_sticky($post_id)) {
            continue;
        }
        /** comments
            ========================================================================
             **/
        $images = get_children(array('post_parent' => $post_id, 'post_type' => 'attachment', 'post_mime_type' => 'image'));
        $comments_count = wp_count_comments($post_id);
        $final_post["comments-count"] = 0;
        if ($comments_count) {
            $final_post["comments-count"] = intval($comments_count->approved);
        }
        /** permalink
            ========================================================================
             **/
        $final_post["permalink"] = get_permalink($post_id);
        if (strlen(trim(get_option('ml_custom_field_url', ''))) > 0) {
            $custom_url_value = get_post_meta($post->ID, get_option('ml_custom_field_url'), true);
            if (strlen(trim($custom_url_value)) > 0) {
                $final_post["permalink"] = $custom_url_value;
            }
        }
        /** categories
            ========================================================================
             **/
        $categories = get_the_category($post_id);
        foreach ($categories as $category) {
            $final_post["categories"][] = array("cat_id" => "{$category->cat_ID}", "name" => $category->cat_name, "slug" => $category->category_nicename);
        }
        if ($taxonomy !== 'category' && !empty($taxonomy)) {
            $terms = wp_get_post_terms($post_id, $taxonomy);
            foreach ($terms as $term) {
                $final_post["categories"][] = array("cat_id" => "{$term->term_id}", "name" => $term->name, "slug" => $term->slug);
            }
        }
        /** date
            ========================================================================
             **/
        $final_post["date"] = $post->post_date;
        if (get_option('ml_datetype', 'prettydate') == 'datetime') {
            $final_post["date_display"] = date_i18n(get_option('ml_dateformat', 'F j, Y'), strtotime($post->post_date), get_option('gmt_offset'));
        }
        /** media
            ========================================================================
             **/
        try {
            $video_id = get_the_first_youtube_id($post);
        } catch (Exception $e) {
        }
        try {
            //featured image
            $main_image_url = get_the_first_image($post);
        } catch (Exception $e) {
            //error getting or resizing the images
        }
        if ($video_id != null) {
            $final_post["videos"][] = $video_id;
        }
        if ($main_image_url != null) {
            $image = array("full" => $main_image_url, "thumb" => array("url" => $main_image_url), "big-thumb" => array("url" => $main_image_url));
            $final_post["images"][0] = $image;
        }
        if (strlen(get_option('ml_custom_featured_image')) > 0 && class_exists('MultiPostThumbnails')) {
            $customImageUrl = MultiPostThumbnails::get_post_thumbnail_url(get_post_type($post->ID), Mobiloud::get_option('ml_custom_featured_image'), $post->ID, 'large');
            if ($customImageUrl !== false) {
                $final_post["images"][0] = array("full" => $customImageUrl, "thumb" => array("url" => $customImageUrl), "big-thumb" => array("url" => $customImageUrl));
            }
//.........这里部分代码省略.........
开发者ID:a-i-ko93,项目名称:ipl-foodblog,代码行数:101,代码来源:posts.php

示例10: get_post_meta

        $link_to = get_post_meta($post->ID, 'external_link', true) ? get_post_meta($post->ID, 'external_link', true) : get_permalink($post->ID);
    }
    $display_size;
    if ($GLOBALS['device_type'] == 'mobile') {
        $display_size = 'small';
    } else {
        $display_size = 'small';
    }
    $off_image = false;
    $off_image = wp_get_attachment_image_src(get_post_thumbnail_id($post->ID), 'xsmall');
    $off_image_large = wp_get_attachment_image_src(get_post_thumbnail_id($post->ID), $display_size);
    if ($off_image) {
        $images_script .= '"off-image-' . $post->ID . '":"' . $off_image_large[0] . '", ';
    }
    $over_image = false;
    $over_image = MultiPostThumbnails::get_post_thumbnail_url('post', 'rollover-image', $post->ID, $display_size);
    if ($over_image) {
        $preload_script .= "'" . $over_image . "',";
        //$images_script .= '"over-image-' . $post->ID . '":"' . $over_image . '", ';
    }
    ?>
				<div class="grid-element <?php 
    echo rtrim($term_class, ' ');
    ?>
">
					<?php 
    if ($link_to) {
        ?>
<a href="<?php 
        echo $link_to;
        ?>
开发者ID:easinewe,项目名称:Avec2016,代码行数:31,代码来源:template-news.php

示例11: array

<?php

/*-----------------------------------------------------------------------------------*/
/* Display featured portfolio project
/*-----------------------------------------------------------------------------------*/
$args = array('posts_per_page' => 1, 'orderby' => 'date', 'order' => 'DESC', 'post_type' => 'ca_portfolio', 'post_status' => 'publish', 'tax_query' => array(array('taxonomy' => 'ca_categories', 'field' => 'slug', 'terms' => 'featured')));
$projects = get_posts($args);
for ($i = 0; $i < count($projects); $i++) {
    $project_id = $projects[$i]->ID;
    $projectName = get_the_title($project_id);
    $projectExcerpt = apply_filters('the_excerpt', get_post_field('post_excerpt', $project_id));
    // Get the featured image to display on the card
    if (class_exists('MultiPostThumbnails') && MultiPostThumbnails::has_post_thumbnail('ca_portfolio', 'homepage-feature-image', $project_id)) {
        $projectImage = MultiPostThumbnails::get_post_thumbnail_url('ca_portfolio', 'homepage-feature-image', $project_id);
    }
    ?>
      <div class="grid__half">
         <h3 class="h2"><?php 
    echo $projectName;
    ?>
</h3>
         <?php 
    echo $projectExcerpt;
    ?>
         <?php 
    echo do_shortcode('[button link="' . get_the_permalink($project_id) . '"]View Project[/button]');
    ?>
      </div>
      <div class="grid__half">
         <img src="<?php 
    echo $projectImage;
开发者ID:praliedutzel,项目名称:creative-anchor,代码行数:31,代码来源:featured-showcase.php

示例12: is_page

<section class="hero <?php 
echo is_page('writings') || is_page('showcase') ? 'hero--small' : '';
?>
">
   <?php 
if (is_front_page()) {
    echo '<div class="hero__gradient"></div>';
}
$postType = get_post_type($id);
if (class_exists('MultiPostThumbnails') && MultiPostThumbnails::has_post_thumbnail($postType, 'hero-image', $id) && !is_archive()) {
    $hero = MultiPostThumbnails::get_post_thumbnail_url($postType, 'hero-image', $id);
    if (MultiPostThumbnails::has_post_thumbnail($postType, 'mobile-hero-image', $id)) {
        $mobileHero = MultiPostThumbnails::get_post_thumbnail_url($postType, 'mobile-hero-image', $id);
    }
    if (MultiPostThumbnails::has_post_thumbnail($postType, 'medium-hero-image', $id)) {
        $mediumHero = MultiPostThumbnails::get_post_thumbnail_url($postType, 'medium-hero-image', $id);
    }
    ?>
      <picture>
         <source media="(min-width: 80em)" srcset="<?php 
    echo $hero;
    ?>
">
         <source media="(min-width: 64em)" srcset="<?php 
    echo $mediumHero;
    ?>
">
         <source media="(max-width: 64em)" srcset="<?php 
    echo $mobileHero;
    ?>
">
开发者ID:praliedutzel,项目名称:creative-anchor,代码行数:31,代码来源:hero.php

示例13: render_card_meta

 /**
  * Renders card meta fields in wp_head
  * @return string
  */
 static function render_card_meta()
 {
     if (!is_singular(array_keys(self::$post_types))) {
         return;
     }
     $vpm_group = get_post_type() . '_twitter_card';
     if (!($card_type = get_vpm_value($vpm_group, 'twitter_card_type', get_queried_object_id()))) {
         return;
     }
     $card_data = array('card' => $card_type, 'title' => self::get_the_title(), 'description' => self::get_the_description());
     switch ($card_type) {
         case 'gallery':
             $images = array();
             for ($i = 1; $i <= 4; $i++) {
                 if (MultiPostThumbnails::has_post_thumbnail(get_post_type(), 'twitter-card-gallery-image-' . $i, get_queried_object_id())) {
                     $images['image' . ($i - 1)] = MultiPostThumbnails::get_post_thumbnail_url(get_post_type(), 'twitter-card-gallery-image-' . $i, get_queried_object_id(), 'medium');
                 }
             }
             if (!empty($images)) {
                 $card_data = array_merge($card_data, $images);
             }
             break;
         case 'summary_large_image':
             if (MultiPostThumbnails::has_post_thumbnail(get_post_type(), 'twitter-card-large-image', get_queried_object_id())) {
                 $card_data['image'] = MultiPostThumbnails::get_post_thumbnail_url(get_post_type(), 'twitter-card-large-image', get_queried_object_id(), 'large');
             }
             break;
         case 'product':
             if (MultiPostThumbnails::has_post_thumbnail(get_post_type(), 'twitter-card-product-image', get_queried_object_id())) {
                 $card_data['image'] = MultiPostThumbnails::get_post_thumbnail_url(get_post_type(), 'twitter-card-product-image', get_queried_object_id(), 'large');
             }
             $card_data['data1'] = get_vpm_value($vpm_group, 'twitter_card_data1', get_queried_object_id());
             $card_data['label1'] = get_vpm_value($vpm_group, 'twitter_card_label1', get_queried_object_id());
             $card_data['data2'] = get_vpm_value($vpm_group, 'twitter_card_data2', get_queried_object_id());
             $card_data['label2'] = get_vpm_value($vpm_group, 'twitter_card_label2', get_queried_object_id());
             break;
         case 'photo':
         case 'summary':
             if (has_post_thumbnail()) {
                 $image = wp_get_attachment_image_src(get_post_thumbnail_id(), 'medium');
                 if ($image) {
                     $card_data['image'] = $image[0];
                 }
             }
             break;
         case 'player':
             $card_data['player'] = get_vpm_value($vpm_group, 'twitter_card_player_url', get_queried_object_id());
             $card_data['player:width'] = get_vpm_value($vpm_group, 'twitter_card_player_width', get_queried_object_id());
             $card_data['player:height'] = get_vpm_value($vpm_group, 'twitter_card_player_height', get_queried_object_id());
             $card_data['image'] = get_vpm_value($vpm_group, 'twitter_card_player_image', get_queried_object_id());
             break;
     }
     // Filter Twitter Card data so any values can be overridden externally from the plugin.
     $card_data = apply_filters('twitter_card_data', $card_data);
     // Gallery cards are not valid unless all four images are set
     // Photo cards are not valid unless there is a image set
     // If not valid, return empty.
     if ($card_type == 'gallery') {
         for ($i = 0; $i < 4; $i++) {
             if (!isset($card_data['image' . $i]) || empty($card_data['image' . $i])) {
                 return;
             }
         }
     } else {
         if ($card_type == 'photo') {
             if (!isset($card_data['image']) || empty($card_data['image'])) {
                 return;
             }
         } else {
             if ($card_type == 'product') {
                 foreach (array('image', 'data1', 'label1', 'data2', 'label2') as $required) {
                     if (!isset($card_data[$required]) || empty($card_data[$required])) {
                         return;
                     }
                 }
             } else {
                 if ($card_type == 'player') {
                     foreach (array('title', 'description', 'image', 'player', 'player:width', 'player:height') as $required) {
                         if (!isset($card_data[$required]) || empty($card_data[$required])) {
                             return;
                         }
                     }
                     if (!empty($card_data['player:stream']) && empty($card_data['player:stream:content_type'])) {
                         return;
                     }
                 }
             }
         }
     }
     foreach ($card_data as $key => $value) {
         if (empty($value)) {
             continue;
         }
         printf('<meta name="twitter:%s" content="%s" />' . PHP_EOL, esc_attr($key), esc_attr($value));
     }
 }
开发者ID:voceconnect,项目名称:wp-twitter-cards,代码行数:100,代码来源:wp-twitter-cards.php

示例14: foreach

    foreach ($term_list as $term) {
        $term_class .= $term->slug . ' ';
    }
    if (get_post_meta($project->ID, 'project_archived', true) != 1) {
        ?>
				<div class="project <?php 
        echo rtrim($term_class, ' ');
        ?>
">
					<a href="<?php 
        echo get_permalink($project->ID);
        ?>
 ">
					<div class="project-thumb" style="background-image: url('<?php 
        if (class_exists('MultiPostThumbnails')) {
            echo MultiPostThumbnails::get_post_thumbnail_url('project', 'menu-image', $project->ID, $display_size);
        }
        ?>
');">
						<div class="module-foreground-rollover" style="background: #<?php 
        echo get_post_meta($project->ID, 'color_space', true);
        ?>
;" >
							<h4><?php 
        echo get_the_title($project->ID);
        ?>
</h4>
						</div>
					</div>
					</a>
				</div>
开发者ID:easinewe,项目名称:Avec2016,代码行数:31,代码来源:header.php

示例15: get_option

        </div>
        <div class='ml-preview-article-list <?php 
echo get_option('ml_article_list_view_type', 'extended') == 'extended' ? 'ml-view-extended' : 'ml-view-compact';
?>
'>
            <div class='scroller'>
                <?php 
$posts = Mobiloud_App_Preview::get_preview_posts();
if (count($posts) > 0) {
    foreach ($posts as $post) {
        $imageUrl = null;
        if (has_post_thumbnail($post->ID)) {
            $image = wp_get_attachment_image_src(get_post_thumbnail_id($post->ID), 'single-post-thumbnail');
            $imageUrl = $image[0];
            if (strlen(Mobiloud::get_option('ml_custom_featured_image')) > 0 && class_exists('MultiPostThumbnails')) {
                $customImageUrl = MultiPostThumbnails::get_post_thumbnail_url(get_post_type($post->ID), Mobiloud::get_option('ml_custom_featured_image'), $post->ID);
                if ($customImageUrl !== false) {
                    $imageUrl = $customImageUrl;
                }
            }
        }
        ?>
                        <div class='ml-preview-article'>
                            <?php 
        if ($imageUrl) {
            ?>
                                <div class="ml-post-img-wrapper">
                                    <img class='ml-preview-img' src='<?php 
            echo $imageUrl;
            ?>
'/>   
开发者ID:WP2Android,项目名称:wordpress-2-android-plugin,代码行数:31,代码来源:app_preview.php


注:本文中的MultiPostThumbnails::get_post_thumbnail_url方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。