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


PHP the_post_thumbnail函数代码示例

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


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

示例1: event_custom_columns

function event_custom_columns($column)
{
    global $post;
    switch ($column) {
        case 'event_thumb':
            if (has_post_thumbnail($post->ID)) {
                the_post_thumbnail('square-menu-thumbnail');
            } else {
                _e('No Image', 'framework');
            }
            break;
        case 'event_dates':
            $startd = get_post_meta($post->ID, 'event_startdate', true);
            $endd = get_post_meta($post->ID, 'event_enddate', true);
            $date_format = get_option('date_format');
            $startdate = date($date_format, $startd);
            $enddate = date($date_format, $endd);
            echo $startdate . '<br/><strong><em>To</em></strong><br/>' . $enddate;
            break;
        case 'event_times':
            $startt = get_post_meta($post->ID, 'event_startdate', true);
            $endt = get_post_meta($post->ID, 'event_enddate', true);
            $time_format = get_option('time_format');
            $starttime = date($time_format, $startt);
            $endtime = date($time_format, $endt);
            echo $starttime . '<br/><strong><em>To</em></strong><br/>' . $endtime;
            break;
    }
}
开发者ID:VladislavMaslakov,项目名称:seven,代码行数:29,代码来源:event-post-type.php

示例2: manage_portfolio_columns

function manage_portfolio_columns($column)
{
    global $post;
    if ($post->post_type == "portfolio") {
        switch ($column) {
            case "description":
                the_excerpt();
                break;
            case "portfolio_categories":
                $terms = get_the_terms($post->ID, 'portfolio_category');
                if (!empty($terms)) {
                    foreach ($terms as $t) {
                        $output[] = "<a href='edit.php?post_type=portfolio&portfolio_tag={$t->slug}'> " . esc_html(sanitize_term_field('name', $t->name, $t->term_id, 'portfolio_tag', 'display')) . "</a>";
                    }
                    $output = implode(', ', $output);
                } else {
                    $t = get_taxonomy('portfolio_category');
                    $output = "No {$t->label}";
                }
                echo $output;
                break;
            case 'thumbnail':
                echo the_post_thumbnail('thumbnail');
                break;
        }
    }
}
开发者ID:kevalbaxi,项目名称:dosomething-blog,代码行数:27,代码来源:portfolio.php

示例3: widget

    function widget($args, $instance)
    {
        extract($args);
        @($title = $instance['title'] ? $instance['title'] : '最热文章');
        @($num = $instance['num'] ? $instance['num'] : 5);
        echo $before_widget;
        ?>
      <div class="panel panel-zan hidden-xs">
        <div class="panel-heading"><?php 
        echo $title;
        ?>
</div>
        <div class="panel-body">
          <ul class="list-group">
            <?php 
        // 设置全局变量,实现post整体赋值
        global $post;
        $posts = zan_get_hotest_posts($num);
        foreach ($posts as $post) {
            setup_postdata($post);
            ?>
              <li class="zan-list clearfix">
                <figure class="thumbnail zan-thumb">
                  <?php 
            the_post_thumbnail(array(75, 75));
            ?>
                </figure>
                <a href="<?php 
            the_permalink();
            ?>
">
                 <h5><?php 
            the_title();
            ?>
</h5>
                </a>
                <div class="sidebar-info">
                  <span><i class="fa fa-calendar"></i> <?php 
            the_time('m月j日, Y');
            ?>
</span>
                  <span><i class="fa fa-comment"></i> <a href="<?php 
            the_permalink();
            ?>
#comments"><?php 
            comments_number('0', '1', '%');
            ?>
</a></span>
                </div>
              </li>
            <?php 
        }
        wp_reset_postdata();
        ?>
          </ul>
        </div>
      </div>
    <?php 
        echo $after_widget;
    }
开发者ID:zhengxiexie,项目名称:wordpress,代码行数:60,代码来源:zan-widget-hotest-posts.php

示例4: launchpad_post_thumbnail

    /**
     * Display an optional post thumbnail.
     *
     * Wraps the post thumbnail in an anchor element on index views, or a div
     * element when on single views.
     *
     * @since Twenty Fifteen 1.0
     */
    function launchpad_post_thumbnail()
    {
        if (post_password_required() || is_attachment() || !has_post_thumbnail()) {
            return;
        }
        if (is_singular()) {
            ?>

            <div class="post-thumbnail">
                <?php 
            the_post_thumbnail();
            ?>
            </div><!-- .post-thumbnail -->

        <?php 
        } else {
            ?>

            <a class="post-thumbnail" href="<?php 
            the_permalink();
            ?>
" aria-hidden="true">
                <?php 
            the_post_thumbnail('post-thumbnail', array('alt' => get_the_title()));
            ?>
            </a>

        <?php 
        }
        // End is_singular()
    }
开发者ID:gocodebox,项目名称:launchpad-framework,代码行数:39,代码来源:helpers.php

示例5: widget

    function widget($args, $instance)
    {
        extract($args);
        $title = apply_filters('widget_title', $instance['title']);
        $number = $instance['number'];
        echo $before_widget;
        if ($title) {
            echo $before_title . $title . $after_title;
        }
        ?>
		<div class="recent-works-items clearfix">
		<?php 
        $args = array('post_type' => 'evolve_portfolio', 'posts_per_page' => $number, 'has_password' => false);
        $portfolio = new WP_Query($args);
        if ($portfolio->have_posts()) {
            ?>
		<?php 
            while ($portfolio->have_posts()) {
                $portfolio->the_post();
                ?>
		<?php 
                if (has_post_thumbnail()) {
                    ?>
		<?php 
                    $link_target = "";
                    $url_check = get_post_meta(get_the_ID(), 'pyre_link_icon_url', true);
                    if (!empty($url_check)) {
                        $new_permalink = get_post_meta(get_the_ID(), 'pyre_link_icon_url', true);
                        if (get_post_meta(get_the_ID(), 'pyre_link_icon_target', true) == "yes") {
                            $link_target = ' target="_blank"';
                        }
                    } else {
                        $new_permalink = get_permalink();
                    }
                    ?>
		<a href="<?php 
                    echo $new_permalink;
                    ?>
"<?php 
                    echo $link_target;
                    ?>
 title="<?php 
                    the_title();
                    ?>
">
			<?php 
                    the_post_thumbnail('recent-works-thumbnail');
                    ?>
		</a>
		<?php 
                }
            }
        }
        wp_reset_query();
        ?>
		</div>

		<?php 
        echo $after_widget;
    }
开发者ID:berniecultess,项目名称:infirev,代码行数:60,代码来源:recent-works-widget.php

示例6: show_faq

function show_faq($atts)
{
    ob_start();
    $secondary_query = new WP_Query(array('post_type' => 'questions', 'posts_per_page' => $atts[limit], 'tax_query' => array(array('taxonomy' => 'faq', 'field' => 'slug', 'terms' => $atts[category], 'operator' => 'IN'))));
    if ($secondary_query->have_posts()) {
        while ($secondary_query->have_posts()) {
            $secondary_query->the_post();
            echo '
								<div class="row">
									<div class="col-lg-8 col-lg-offset-2 centered">
							';
            the_post();
            the_post_thumbnail('thumbnail');
            the_title('<h1>', '</h1>');
            the_content();
            echo '
									</div>
								</div>
							';
        }
        // end while
    }
    // end if
    wp_reset_postdata();
    return ob_get_clean();
}
开发者ID:avikour,项目名称:myfaq-wordpress-plugin,代码行数:26,代码来源:shortcode.php

示例7: vl_featured_post_image

function vl_featured_post_image()
{
    $post_video = get_the_post_video_url($post_id);
    // $post_video = https://vimeo.com/example
    if (strpos($post_video, 'vimeo.com') !== FALSE) {
        $x = explode('/', $post_video);
        // $x = ['https:', 'vimeo.com', 'example']
        $video_id = array_pop($x);
        // $video_id = 'example'
        $player_url = '//player.vimeo.com/video/' . $video_id . '?autoplay=1&color=FFF';
        // $player_url = '//player.vimeo.com/video/example'
    }
    echo '<div class="entry">';
    echo '<a class="video-thumbnail" href="';
    echo $player_url;
    echo '" data-featherlight="iframe">';
    echo '<div class="entry-thumbnail">';
    the_post_thumbnail('large');
    //you can use medium, large or a custom size
    echo '<div class="play-button"></div>';
    echo '</div>';
    echo '</a>';
    // echo get_the_post_video( $post_id );
    // echo '<iframe class="lightbox" src="' . get_the_post_video_url( $post_id ) . '" id="';
    // echo get_the_ID();
    // echo '" style="border:none;" webkitallowfullscreen="" mozallowfullscreen="" allowfullscreen=""></iframe>';
    // echo '</div>';
}
开发者ID:elliebartling,项目名称:genesis-freetogether,代码行数:28,代码来源:video-lightboxes.php

示例8: gallery_custom_columns

function gallery_custom_columns($column)
{
    global $post;
    switch ($column) {
        case 'gallery-thumb':
            if (has_post_thumbnail($post->ID)) {
                ?>
					<a href="<?php 
                the_permalink();
                ?>
" target="_blank">
						<?php 
                the_post_thumbnail('square-menu-thumbnail');
                ?>
					</a>
					<?php 
            } else {
                _e('No Thumbnail', 'framework');
            }
            break;
        case 'type':
            echo get_the_term_list($post->ID, 'gallery-item-type', '', ', ', '');
            break;
    }
}
开发者ID:VladislavMaslakov,项目名称:seven,代码行数:25,代码来源:gallery-post-type.php

示例9: widget

	function widget($args, $instance) {
		extract($args);
		$title = apply_filters( 'widget_title', empty($instance['title']) ? '' : $instance['title'], $instance );

		$number = $instance['number'];
		
		echo $before_widget;

		if($title) {
			echo $before_title . $title . $after_title;
		}
		?>
		<div class="recent-works-items clearfix">
		<?php
		$args = array(
			'post_type' => 'portfolio',
			'posts_per_page' => $number
		);
		$portfolio = new WP_Query($args);
		if($portfolio->have_posts()):
		?>
		<?php while($portfolio->have_posts()): $portfolio->the_post(); ?>
		<div class="portfolio-widget-item">
            <?php if (has_post_thumbnail()) { ?>
            	<a href="<?php the_permalink() ?>" title="<?php the_title(); ?>" class="portfolio-image"><?php the_post_thumbnail( 'mini' ); ?></a>
            <?php } ?>
       </div>
		<?php endwhile; endif; ?>
		</div>

		<?php echo $after_widget;
	}
开发者ID:kevinreilly,项目名称:mendelements.com,代码行数:32,代码来源:portfolio.php

示例10: FeedShortcode

    /**
     * Add Shortcode
     * @param $atts
     */
    public function FeedShortcode($atts)
    {
        // Attributes
        extract(shortcode_atts(array('number' => '4', 'sort' => 'date_listed'), $atts));
        $args = array('posts_per_page' => $number, 'post_type' => 'property', 'orderby' => 'meta_value', 'meta_key' => 'wptrebs_last_updated_text');
        $query = new WP_Query($args);
        if ($query->have_posts()) {
            echo '<ul class="wptrebs_feed">';
            while ($query->have_posts()) {
                $query->the_post();
                ?>
                <li class="wptrebs_feed_item">
                    <div class="price"><span>$</span><?php 
                echo number_format(get_post_meta(get_the_ID(), 'wptrebs_price', true));
                ?>
</div>
                    <a href="<?php 
                the_permalink();
                ?>
"><?php 
                the_post_thumbnail('wptrebs_feed_img');
                ?>
</a>
                </li>
                <?php 
            }
            // end while
            echo '</ul>';
            echo '<div class="wptrebs_clear"></div>';
        }
        // end if
    }
开发者ID:LeapXD,项目名称:wptrebrets,代码行数:36,代码来源:Shortcodes.php

示例11: ff_the_post_thumbnail

 function ff_the_post_thumbnail()
 {
     // See /templates/onePage/blocks/blog-featured-area/blog-featured-area.php
     // And maybe /templates/helpers/class.ff_Featured_Area.php
     // And maybe /templates/helpers/func.ff_Gallery.php
     the_post_thumbnail();
 }
开发者ID:migumuno,项目名称:nordicainteriores,代码行数:7,代码来源:wordpress-wrappers.php

示例12: oe_main_slider

function oe_main_slider($numbers = -1)
{
    global $post;
    $query = new WP_Query(array('post_type' => 'slider', 'posts_per_page' => $numbers));
    $imgArray = array();
    if ($query->have_posts()) {
        echo '<div id="header_slider" class="owl-carousel owl-theme">';
        while ($query->have_posts()) {
            $query->the_post();
            $slide_color = get_post_meta($post->ID, 'oe_slider_bg', true);
            ?>
        <div class="item slider-info" style="background-color:<?php 
            echo $slide_color;
            ?>
;">
            <div class="text-slider">
                <?php 
            the_content();
            echo '<a href="#" id="scroll_to"><span class="scroll-down"><span class="img-scroll-down"></span></span>' . __('see what we can do for you.', 'oneengine') . '</a>';
            ?>
            </div>
            <?php 
            the_post_thumbnail('full');
            ?>
        </div>
        
    <?php 
        }
        echo '</div>';
    }
    wp_reset_query();
}
开发者ID:djs11491,项目名称:gallant,代码行数:32,代码来源:template.php

示例13: widget

    /**
     * front-end display of the widget
     * 
     * @param  $args		widget arguments
     * @param  $instance	saved values from database
     */
    public function widget($args, $instance)
    {
        extract($args);
        $title = apply_filters('widget_title', $instance['title']);
        $page_id = apply_filters('page_thumbani_page_id', $instance['page_id']);
        $thumbnail_size = apply_filters('page_thumbani_thumbnail_size', $instance['thumbnail_size']);
        echo $before_widget;
        if (!empty($title)) {
            echo $before_title . $title . $after_title;
        }
        $wp_query = new WP_Query(array('page_id' => $page_id));
        if ($wp_query->have_posts()) {
            while ($wp_query->have_posts()) {
                $wp_query->the_post();
                ?>

				<div class="text-center page-thumbnail-widget--content circle-hover">
				    <?php 
                if (has_post_thumbnail()) {
                    the_post_thumbnail($thumbnail_size, array('class' => 'img-center img-circle img-responsive'));
                }
                ?>
				</div>
			    <?php 
                the_title('<div class="row"><div class="col-md-10 col-md-offset-1 text-center"><h3 class="page-thumbnail-title"><a href="' . get_the_permalink() . '">', '</a></h3></div></div>');
                ?>

			<?php 
            }
        }
        wp_reset_query();
        echo $after_widget;
    }
开发者ID:asmax,项目名称:Bodhi-Yoga,代码行数:39,代码来源:widget-page-thumbnail.php

示例14: widget

 /**
  * Front-end display of widget.
  *
  * @see WP_Widget::widget()
  *
  * @param array $args     Widget arguments.
  * @param array $instance Saved values from database.
  */
 public function widget($args, $instance)
 {
     $instance = wp_parse_args($instance, array('title' => '', 'post_type' => 'micro-projet'));
     echo $args['before_widget'];
     if ($instance['title']) {
         /** This filter is documented in core/src/wp-includes/default-widgets.php */
         echo $args['before_title'] . apply_filters('widget_title', $instance['title']) . $args['after_title'];
     }
     // Show last micro project
     $micro_project_query_args = array('post_type' => $instance['post_type'], 'posts_per_page' => 5);
     if (is_singular()) {
         $micro_project_query_args['post__not_in'] = array(get_the_ID());
     }
     $micro_project_query = new WP_Query($micro_project_query_args);
     if ($micro_project_query->have_posts()) {
         echo '<ul>';
         while ($micro_project_query->have_posts()) {
             $micro_project_query->the_post();
             echo '<li>';
             echo '<a href="' . get_the_permalink() . '">';
             the_post_thumbnail('large');
             the_title('<h3>', '</h3>');
             echo '</a>';
             echo '</li>';
         }
         echo '</ul>';
         wp_reset_postdata();
     }
     echo $args['after_widget'];
 }
开发者ID:ArnaudBan,项目名称:claire-jacquinod-plugin,代码行数:38,代码来源:last-micro-projet-widget.php

示例15: manage_product_columns

function manage_product_columns($column_name, $product_id)
{
    $price_value = product_price($product_id);
    switch ($column_name) {
        case 'id':
            echo $product_id;
            break;
        case 'shortcode':
            echo '[show_products product="' . $product_id . '"]';
            break;
        case 'price':
            if ($price_value != '') {
                echo price_format($price_value);
            }
            break;
        case 'image':
            echo the_post_thumbnail(array(40, 40));
            break;
        case 'product_cat':
            echo get_the_term_list($product_id, 'al_product-cat', '', ', ', '');
            break;
        default:
            break;
    }
}
开发者ID:nanookYs,项目名称:orientreizen,代码行数:25,代码来源:product-columns.php


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