我想让我的页面显示 2 个最近的帖子,所以我使用 WP_Query 并将 posts_per_page 设置为 2,效果很好,但它会破坏分页。这是我的代码。如何更改它以显示两个最近的帖子并保持分页?
  <?php $wp_query = new WP_Query( array( 'posts_per_page' =>2 ));?>
  <?php if ( $wp_query->have_posts() ) : ?>
  <?php while ( $wp_query->have_posts() ) : $wp_query->the_post(); ?>
<div <?php post_class() ?> id="post-<?php the_ID(); ?>">
    <div id="ind_post">
        <h2 class="post-title"><a href="<?php the_permalink() ?>"><?php the_title(); ?></a></h2>
        <div id="entry">
        <?php include (TEMPLATEPATH . '/inc/meta.php' ); ?>
            <p><?php the_excerpt(); ?></p>
        </div>
        <h4 class="more-post"><a href="<?php the_permalink() ?>">continue reading…</a></h4>
    </div>
<?php endwhile; ?>
<?php include (TEMPLATEPATH . '/inc/nav.php' ); ?>
    <?php else : ?>
    <h2>No results found</h2>
<?php endif; ?>
        <?php wp_reset_query(); ?>