置顶文章归置顶的样式,在循环文章列表中排除置顶文章。
Case1置顶列表解决方案:
在要插入置顶文章列表的地方写入一下语句:
代码如下1, "post__in" => get_option("sticky_posts"), "caller_get_posts" => 1 )); if (have_posts()) : while (have_posts()) : the_post(); ?>
将置顶文章的代码表示如下:
代码如下
- id="post-">
" rel="bookmark" title="详细阅读 ">
( 于post_modified); ?>更新 )
最后结束置顶循环列表:
代码如下
Case2排除置顶文章的列表解决方案:
在原先的循环语句上替换如下去除置顶列表的代码:
$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();
?>
Ok!赶紧更新index.php,刷新下首页看看
[wordpress置顶文章]WordPress置顶文章与非置顶文章的列表分离
http://m.bbyears.com/wangyezhizuo/41259.html
推荐访问: