SO网友:Brooke.
您可以使用custom loop 获取所有杆柱,然后返回所有正常杆柱。您可能需要稍微修改一下此代码,但下面是如何返回所有粘性帖子。您可以为各个页面使用第二个自定义循环,只返回一篇文章。
//is sticky
$sticky = get_option( \'sticky_posts\' );
if(!empty($sticky)){
$args = array(
\'posts_per_page\' => -1, //get all post
\'post__in\' => $sticky, //are they sticky post
);
// The Query
$the_query = new WP_Query( $args );
// The Loop //we are only getting a list of the title as a li see the loop docs for details on the loop or copy this from index.php (or posts.php)
while ( $the_query->have_posts() ) {
$the_query->the_post();
echo \'<li>\' . get_the_title() . \'</li>\';
}
wp_reset_query(); //reset the original WP_Query
}
//now get the not sticky post
$args2 = array(
\'posts_per_page\' => -1, //get all post
\'post__not_in\' => $sticky, //are they NOT sticky post
);
// The Query
$the_query2 = new WP_Query( $args2 );
// The Loop....
这是一段入门代码,因为我不会为您编写项目,如果没有代码/可视化示例,很难准确地理解您想要做什么。