我正在写博客(http://goo.gl/xazMe0) 这是索引的代码。php:
<div id="main-content" class="main-content row">
<div id="primary" class="content-area <?php echo $longform_site_width; ?>">
<div id="content" class="site-content" role="main">
<?php
if ( have_posts() ) :
// Start the Loop.
while ( have_posts() ) : the_post();
get_template_part( \'content\', get_post_format() );
endwhile;
longform_paging_nav();
else :
get_template_part( \'content\', \'none\' );
endif;
?>
</div><!-- #content -->
</div><!-- #primary -->
</div><!-- #main-content -->
Issue: Instead of showing all the whole posts on the index page, immediately, I want to show only the featured images of the posts and then make these clickable to enter the post with the full content.
所以,我想,我必须去掉这条线
get_template_part( \'content\', get_post_format() );
然后用类似
<a href="<?php the_permalink() ?>">
<?php if ( has_post_thumbnail() ) { the_post_thumbnail();} ?>
</a>
这或多或少起到了作用,但它完全破坏了网站的外观,显示了像拼图一样聚集在一起的所有特色图像,这意味着它根本不尊重HTML结构和CSS代码。
这意味着,通过这种方法,我必须重建一切,让它回到过去的样子,或者它在帖子中的外观。
Is there not a more simpler way to get
get_template_part( \'content\', get_post_format () );
work the way I want it to (showing only featured image and be clickable to enter post)? 伙计们,先谢谢你们。