由于 Wordpress 粘性帖子功能允许在帖子发布面板中检查为粘性的帖子放置在帖子首页的顶部。
我想在索引中显示所有帖子而没有粘性帖子:
if ( have_posts() ) :
?>
<div class="row my-4">
<?php
while ( have_posts() ) :
the_post();
/**
* Include the Post-Format-specific template for the content.
* If you want to overload this in a child theme then include a file
* called content-___.php (where ___ is the Post Format name) and that will be used instead.
*/
get_template_part( 'content', 'index' ); // Post format: content-index.php
endwhile;
?>
</div>
<?php
endif;
wp_reset_postdata();