我相信有很多的小伙伴有wordpress页面调用指定分类并翻页这种需求,因为在wordpress开发中这种需求并不少见,例如今天瑞课在改版过程中需要调用资源版块分类的内容并翻页那么就用到了今天讲的wordpress页面调用指定分类并翻页功能,如果您也有此相关的需求可以使用此方法哟。
<?php $current_user->ID==$curauth->ID){
$limit = get_option('posts_per_page');
$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
query_posts('cat=4&showposts=' . $limit=10 . '&paged=' . $paged);
while ( have_posts() ) : the_post();
get_template_part('inc/archive');
endwhile; // end of the loop.
the_posts_pagination( array(
'prev_text' => __( '上页', 'twentysixteen' ),
'next_text' => __( '下页', 'twentysixteen' ),
'before_page_number' => '<span class="meta-nav screen-reader-text">第 </span>',
'after_page_number' => '<span class="meta-nav screen-reader-text"> 页</span>',
) );
wp_reset_query();
}
?>
以上呢我就不详细介绍了,这里只提供那些稍微有基础的没基础的看完也是白看,这么这里只是做个笔记,此方法在作者页测试有效其它暂无测试!本站还有其它相关单页调用分类的教程、、、

