【发布时间】:2019-01-22 02:57:59
【问题描述】:
我设置了一个基本主页,每页显示 3 篇文章,并通过分页浏览这些页面。目前它只会显示第 1 页和第 2 页的分页,即使我有 12 篇文章导致 4 页。我不太确定我哪里出错了:
<?php
$paged = (get_query_var('paged'))? get_query_var('paged') : '1';
$args = array(
'post_type' => 'post',
'post_status' => 'publish',
'paged' => $paged,
'posts_per_page' => 2
);
$the_query = new WP_Query( $args );
while ($the_query -> have_posts()) : $the_query -> the_post();
include(locate_template('content-post.php' ));
endwhile;
?>
<?php the_posts_pagination( array('mid_size' => 3) ); ?>
【问题讨论】:
标签: php wordpress pagination