我们在设计WordPress主题的时候,正常的内容列表的调用的同时应该还需要有一个置顶内容调用的。我们需要在内容列表中或者首页列表上面设置置顶内容,这个如何调用呢?
<?php $query_post = array(
'posts_per_page' => 2,
'post__in' => get_option('sticky_posts'),
'ignore_sticky_posts' => 1
);
query_posts($query_post);
?>
<?php while(have_posts()):the_post(); ?>
.这里调用标题和描述类似列表..
<?php endwhile; ?>
<?php wp_reset_query();?>
具体的参数可以根据需要调整。


评论