我正在使用以下代码进行查询帖子,但我没有得到分页链接。以下代码的问题在哪里。
<div id="primary" class="content-area">
<main id="main" class="site-main" role="main">
<?php
$arr = array(
\'post_type\' => \'post\',
\'posts_per_page\' => 3
);
$the_query = new WP_Query($arr);
?>
<?php if ( $the_query->have_posts() ) : ?>
<?php if ( is_home() && ! is_front_page() ) : ?>
<header>
<h1 class="page-title screen-reader-text"><?php single_post_title(); ?></h1>
</header>
<?php endif; ?>
<?php
// Start the loop.
while ( $the_query->have_posts() ) : $the_query->the_post();
get_template_part( \'content\', get_post_format() );
// End the loop.
endwhile; ?>
<div class="nav-previous alignleft"><?php next_posts_link(\'Older Post\'); ?></div>
<div class="nav-next alignright"><?php previous_posts_link( \'Newer posts\' ); ?></div>
<?php
wp_reset_postdata();
endif;
?>
</main><!-- .site-main -->
</div><!-- .content-area -->