I made pagination but, it not work corrent, in each page showing same posts.
Code:
<?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; ?>
I can’t found problem, maybe problem is that I using “taxonomy”.
The problem is that you are executing the same query over and over:
You need to set an offset in the WP_Query array:
'offset'=> 2We can calculate the offset by using a global variable that wordpress uses called
$pageby using a simple equation:$offset = ($page -1) * $post_per_page;so your final WP_QUERY should look something like: