其实旅行最大的好处,不是能见到多少人,见过多美的风景,而是走着走着,在一个际遇下,突然重新认识了自己。
将下面的代码添加到主题 archive.php 或者 category.php 模板主循环上面:
- <?php
- query_posts(array(
- "category__in"=>array(get_query_var("cat")),
- "post__in"=>get_option("sticky_posts"),
- 'showposts'=>3,
- )
- );
- while(have_posts()):the_post();
- ?>
- <h1>置顶<arel="nofollow noopener noreferrer" href="<?phpthe_permalink();?>"title="<?phpthe_title();?>"><?phpthe_title();?></a></h1>
- <?php
- endwhile;
- wp_reset_query();
- ?>
其中: 'showposts' => 3, 是显示数量。
答案内容来自知更鸟
以上就是WordPress分类列表页怎么置顶本分类文章?。高标准,精细化,零缺陷。更多关于WordPress分类列表页怎么置顶本分类文章?请关注haodaima.com其它相关文章!