o2o网站模版,阿里云备案要关网站吗,wordpress换背景插件,富阳有没有做网站的文章来源: https://www.xuewangzhan.net/wpbbs/15737.html
wordpress网站后台允许我们设置一些置顶文章#xff0c;然后通过调用置顶文章的代码把它调用到自己的网站前台。
下面是最常用的wordpress调用置顶文章代码#xff0c;适用于所有模板使用。
?php
$sticky g…文章来源: https://www.xuewangzhan.net/wpbbs/15737.html
wordpress网站后台允许我们设置一些置顶文章然后通过调用置顶文章的代码把它调用到自己的网站前台。
下面是最常用的wordpress调用置顶文章代码适用于所有模板使用。
?php
$sticky get_option(sticky_posts);
rsort( $sticky );
$sticky array_slice( $sticky, 0, 5);
query_posts( array( post__in $sticky, caller_get_posts 1 ) );
if (have_posts()) :while (have_posts()) : the_post();
?lia href?php the_permalink(); ? target_blank?php the_title(); ?/a/li?php endwhile; endif; ? 代码解释
rsort( $sticky ); 对置顶文章数组逆向排序即大ID在前$sticky array_slice( $sticky, 0, 5);控制显示置顶文章的数量输出置顶文章数请修改50不要动如果需要全部置顶文章输出可以把这句注释掉post__in get_option(sticky_posts)确定了该LOOP调用的是置顶文章列表。caller_get_posts的作用是排除非指定性文章即除了置顶文章之外不显示其他的文章。
wordpress文章置顶方法
【后台】--【文章】--【编辑】---【将文章置顶到顶部】