0
我在single.php
中使用get_template_part('content');
。功能the_post_thumbnail('large-thumbnail');
功能完美地顯示縮略圖。但它不會在content.php
中顯示is_single()
函數。is_single()函數不顯示縮略圖圖像
content.php代碼:
<?php
if(is_single()){
the_post_thumbnail('large-thumbnail');
the_content();
}else{
the_post_thumbnail('small-thumbnail');
echo get_the_excerpt();
?>
<a href="<?php the_permalink(); ?>">Read more»</a>
<?php } ?>
的single.php:
<article>
<div class="single_post_content">
<h5><?php the_title(); ?></h5>
<?php
get_template_part('content');
?>
</div>
</article>