wordpress教程

wordpress教程:最新文章列表中排除置顶文章

wordpress教程 51源码 2022-11-09 人阅读
前几天在做一个wordpress cms主题想把最新文章列表和置顶文章列表分开显示,可在调用最新文章列表时发现,如果wordpress博客有置顶文章,那 么最新文章列表也会把博客的置顶文章显示在最前面,但是可以通过设置置顶文章的参数caller_get_posts排除列表中的最新文章。       $post_num = 10; // 显示文章的数量.     $args=array(     'post_status' => 'publish',     'paged' => $paged,     'caller_get_posts' => 1,     'posts_per_page' => $post_num     );     query_posts($args);     // 主循环     if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>      ""> endwhile; else: endif; wp_reset_query();?>
版权声明:文章搜集于网络,如有侵权请联系本站,转载请说明出处:https://www.51yma.cn/jiaocheng/wordpress/503.html
文章来源: