我正在使用我的主页显示我的所有帖子。因此我使用WP_Query
.
当我单击分页时,url会更改,但页面内容不会更改。
这是我的密码,
<?php
$paged = (get_query_var(\'page\')) ? get_query_var(\'page\') : 1;
$args = array( \'post_type\' => \'post\', \'posts_per_page\' => 10, \'page\' => $paged );
$wp_query = new WP_Query($args);
while ( have_posts() ) : the_post(); ?>
<div class="home-post">
<h2 class="entry-title"><?php the_title(); ?></h2>
<div class="thumb-img">
<img src="<?php the_post_thumbnail(); ?>" alt="" />
<div class="thumb-hover"></div>
</div>
<!--/ thumb image -->
<div class="post-excerpt">
<?php the_excerpt(__(\'(more…)\')); ?>
</div>
<!--/ post excerpt -->
<a class="readmore" href="<?php the_permalink(); ?>">Continue Reading</a>
</div>
<!--/ home post -->
<?php endwhile; ?>
<div class="home-pagination">
<!-- then the pagination links -->
<?php next_posts_link( \'← Older posts\', $wp_query ->max_num_pages); ?>
<?php previous_posts_link( \'Newer posts →\' ); ?>
</div>