您可以尝试使用以下代码来显示分页页面。我将6设置为posts_per_page
限制每页显示6篇文章。
<?php
//build $args for fetch records...
$paged = ( get_query_var( \'paged\' ) ) ? get_query_var( \'paged\' ) : 1;
$args = array(
\'posts_per_page\' => 6,//display post per page
\'paged\' => $paged,
\'cat\' => 1
);
//Fetch and loop until records..
$my_query = new WP_Query($args);
while ($my_query->have_posts()):
$my_query->the_post();
$do_not_duplicate = $post->ID;?>
<a href="<?php the_permalink() ?>"><?php the_title(); ?></a></br>
<?php endwhile; ?>
<!--For display links-->
<?php next_posts_link(); ?>
<?php previous_posts_link(); ?>