Wordpress编号分页&使用query_posts更新当前页面

时间:2015-07-23 09:08:05

标签: php wordpress pagination

我可以添加编号分页到wordpress罚款,问题是当我点击第二页时,第一页的链接似乎不可点击。循环仍然认为它在第一页。

这是我目前的代码。

<?php query_posts('posts_per_page=5'); ?>

<?php if (have_posts()) : while (have_posts()) : the_post(); ?>

 ....


<?php endwhile; 

endif; ?>

  <?php
global $wp_query;

$big = 999999999; // need an unlikely integer

 echo paginate_links( array(
 'base' => str_replace( $big, '%#%', esc_url( get_pagenum_link( $big )         )  ),
 'format' => '?paged=%#%',
  'current' => max( 1, get_query_var('paged') ),
  'total' => $wp_query->max_num_pages
 ) );
 ?>

0 个答案:

没有答案
相关问题