php 排除粘贴帖子
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了php 排除粘贴帖子相关的知识,希望对你有一定的参考价值。
https://www.wpbeginner.com/wp-themes/how-to-exclude-sticky-posts-from-the-loop-in-wordpress/
<div class="accordion-body">
<?php
$args = [
'post_type' => 'post',
'posts_per_page' => 10,
'post__not_in' => get_option( 'sticky_posts' ) // ignore sticky posts, they are already at the top
];
$sidebar_posts = new WP_Query($args);
?>
<ul>
<?php while( $sidebar_posts->have_posts() ) : $sidebar_posts->the_post(); ?>
<li><a href="<?php echo get_permalink() ; ?>">
<?php echo $sidebar_posts->post->post_title ; ?></a>
</li>
<?php endwhile; ?>
</ul>
</div>
以上是关于php 排除粘贴帖子的主要内容,如果未能解决你的问题,请参考以下文章