我进行了分页,但它不能正常工作,在每个页面中都显示相同的帖子。
代码:
<?php if ( have_posts() ) : ?>
<?php $query = new WP_Query( array('post_type' => 'post', 'kalba' => 'Lietuviu', 'posts_per_page' => 2) );?>
<?php while ( $query->have_posts() ) : $query->the_post();?>
<h2 class="title"><a href ="<?php the_permalink();?>"><?php echo $query->post->post_title;?></a></h2>
<div class="date"><?php echo mysql2date('Y-m-d', $query->post->post_date);?></div>
<div class="post"><p><?php echo $query->post->post_content;?></p></div>
<?php endwhile;?>
<? $big = 999999999; // need an unlikely integer
echo paginate_links( array( 'base' => str_replace( $big, '%#%', get_pagenum_link( $big ) ),
'format' => '?paged=%#%',
'current' => max( 1, get_query_var( 'paged' ) ),
'total' => $query->max_num_pages,
'end_size'=> 1,
'mid_size'=> 10 ) );?>
<?php endif; ?>
我找不到问题,也许问题是我使用“分类法”。