Title: Pagination Displaying Same Content
Last modified: August 30, 2016

---

# Pagination Displaying Same Content

 *  Resolved [Blue Phoenix](https://wordpress.org/support/users/blue-phoenix/)
 * (@blue-phoenix)
 * [10 years, 9 months ago](https://wordpress.org/support/topic/pagination-displaying-same-content/)
 * I’m trying to get pagination working on a test site that I’m developing with 
   the hope to add Ajax to use a load more function however at present my pages 
   display the same 5 posts every time I click on the next page link. Would appreciate
   some advice on this
 *     ```
       <?php
                   $page = (get_query_var('paged')) ? get_query_var('paged') : 1;
   
                   $args=array(
                   'caller_get_posts'=>1,
                   'offset' => 1,
                   'orderby' => 'title',
                   'order'   => 'DESC',
                   'posts_per_page' => 5,
                   'paged' => $page
               );
                   $my_query = new WP_Query($args);
                   if( $my_query->have_posts() )  {
                   while ($my_query->have_posts()) : $my_query->the_post(); ?>
                       <article class="row sub-article">
                           <a href="<?php the_permalink();?>" title="<?php the_title();?>">
                               <div class="col-xs-4">
                                   <?php the_post_thumbnail('secondary-thumb', array('class' => 'img-responsive')); ?>
                               </div>
                               <div class="col-xs-8">
                                   <h4><?php the_title();?></h4>
                               </div>
                           </a>
                       </article>
   
                   <?php endwhile;} ?>
                   <?php posts_nav_link(); ?>
                   <?php wp_reset_postdata(); ?>
       ```
   

Viewing 2 replies - 1 through 2 (of 2 total)

 *  [Michael](https://wordpress.org/support/users/alchymyth/)
 * (@alchymyth)
 * [10 years, 9 months ago](https://wordpress.org/support/topic/pagination-displaying-same-content/#post-6275054)
 * try and remove the `'offset'` parameter, and try to use a different way to exclude
   the first post.
 * also, `posts_nav_link()` only works on the default query;
    try to work with [https://codex.wordpress.org/Function_Reference/next_posts_link](https://codex.wordpress.org/Function_Reference/next_posts_link)(
   particular review [https://codex.wordpress.org/Function_Reference/next_posts_link#Usage_when_querying_the_loop_with_WP_Query](https://codex.wordpress.org/Function_Reference/next_posts_link#Usage_when_querying_the_loop_with_WP_Query))
   and [https://codex.wordpress.org/Function_Reference/previous_posts_link](https://codex.wordpress.org/Function_Reference/previous_posts_link)(
   apply the same coding as for ‘next_posts_link()’)
 *  Thread Starter [Blue Phoenix](https://wordpress.org/support/users/blue-phoenix/)
 * (@blue-phoenix)
 * [10 years, 9 months ago](https://wordpress.org/support/topic/pagination-displaying-same-content/#post-6275162)
 * Thanks for the steer, really helped and managed to find a working solution
 *     ```
       <?php
                   $display_count = 5;
                   $page = (get_query_var('paged')) ? get_query_var('paged') : 1;
                   $offset = ($display_count * ($page - 1)) + 1;
   
                   $args=array(
                   'caller_get_posts'=>1,
                   'orderby' => 'title',
                   'order'   => 'DESC',
                   'posts_per_page' => $display_count,
                   'page'       =>  $page,
       	        'offset'     =>  $offset
               );
                   $my_query = new WP_Query($args);
                   if( $my_query->have_posts() )  {
                   while ($my_query->have_posts()) : $my_query->the_post(); ?>
                       <article class="row sub-article">
                           <a href="<?php the_permalink();?>" title="<?php the_title();?>">
                               <div class="col-xs-4">
                                   <?php the_post_thumbnail('secondary-thumb', array('class' => 'img-responsive')); ?>
                               </div>
                               <div class="col-xs-8">
                                   <h4><?php the_title();?></h4>
                               </div>
                           </a>
                       </article>
   
                   <?php endwhile;} ?>
                   <?php next_posts_link(); ?>
                   <?php previous_posts_link(); ?>
                   <?php wp_reset_postdata(); ?>
       ```
   

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Pagination Displaying Same Content’ is closed to new replies.

## Tags

 * [pagenation](https://wordpress.org/support/topic-tag/pagenation/)
 * [posts](https://wordpress.org/support/topic-tag/posts/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 2 replies
 * 2 participants
 * Last reply from: [Blue Phoenix](https://wordpress.org/support/users/blue-phoenix/)
 * Last activity: [10 years, 9 months ago](https://wordpress.org/support/topic/pagination-displaying-same-content/#post-6275162)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
