Title: xrayeye's Replies | WordPress.org

---

# xrayeye

  [  ](https://wordpress.org/support/users/xrayeye/)

 *   [Profile](https://wordpress.org/support/users/xrayeye/)
 *   [Topics Started](https://wordpress.org/support/users/xrayeye/topics/)
 *   [Replies Created](https://wordpress.org/support/users/xrayeye/replies/)
 *   [Reviews Written](https://wordpress.org/support/users/xrayeye/reviews/)
 *   [Topics Replied To](https://wordpress.org/support/users/xrayeye/replied-to/)
 *   [Engagements](https://wordpress.org/support/users/xrayeye/engagements/)
 *   [Favorites](https://wordpress.org/support/users/xrayeye/favorites/)

 Search replies:

## Forum Replies Created

Viewing 1 replies (of 1 total)

 *   Forum: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
   
   In reply to: [How get pagination to work when querying for custom type posts on a category](https://wordpress.org/support/topic/how-get-pagination-to-work-when-querying-for-custom-type-posts-on-a-category/)
 *  Thread Starter [xrayeye](https://wordpress.org/support/users/xrayeye/)
 * (@xrayeye)
 * [13 years, 9 months ago](https://wordpress.org/support/topic/how-get-pagination-to-work-when-querying-for-custom-type-posts-on-a-category/#post-3199979)
 * Hi alchymyth,
 * Thanks so much for your reply. That helped as the pagination is now showing, 
   but it’s stuck always on the first page.
 * This how my code is looking right now:
 *     ```
       $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
       $temp = $featured; // assign ordinal query to temp variable for later use
       $featured = null;
       $featured = new WP_Query(array( 'post_type' => 'projects','category__in'=> 14, 'post_status' => 'publish', 'posts_per_page' => 2, 'paged' => $paged)); ?>
   
       if ( $featured->have_posts() ) while ( $featured->have_posts()) : $featured->the_post();
   
       <div id="content">
       </div>
   
        <?php endwhile; ?>
        <?php wp_reset_postdata(); // reset the query ?>  
   
       <div class="pagination">
       <span class="pag-next"><?php next_posts_link('Older Entries »', $featured->max_num_pages); ?> </span>
       <span class="pag-previous"><?php previous_posts_link('Newer Entries', $featured->max_num_pages); ?></span>
       </div> 
   
       $temp = $featured; // assign ordinal query to temp variable for later use
       $featured = null;
       ```
   
 * Maybe it has something to do with the way I’m running the loop on other pages.
   There’s a projects page where I’m displaying thumbnails of all the project posts
   like this:
 *     ```
       <?php $paged = (get_query_var('paged')) ? get_query_var('paged') : 1; ?>
       <?php $projects_query = new WP_Query(array( 'post_type' => 'projects','post_status' => 'publish', 'posts_per_page' => 9, 'paged' => $paged));
       while($projects_query->have_posts()) : $projects_query->the_post(); ?>
           <div id="content">
   
           </div>
       <?php endwhile; ?>
       <?php wp_reset_postdata(); // reset the query ?>  
   
       <div class="pagination">
           <span class="pag-next"><?php next_posts_link(); ?> </span>
           <span class="pag-previous"><?php previous_posts_link(); ?></span>
       </div>
       ```
   
 * And the blog page where I display regular posts looks like this:
 *     ```
       $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
       $temp = $journal; // assign ordinal query to temp variable for later use
       $journal = null;
       $journal = new WP_Query(array( 'post_type' => 'post','post_status' => 'publish', 'posts_per_page' => 3,'paged' => $paged ));
   
       if ( have_posts() ) while ( have_posts() ) : the_post(); 
   
       <div id="content">
       </div>
   
       <?php endwhile; // end of the loop. ?>
       <?php wp_reset_postdata(); // reset the query ?>  
   
       <div class="pagination">
           <span class="pag-next"><?php next_posts_link(); ?> </span>
           <span class="pag-previous"><?php previous_posts_link(); ?></span>
       </div>
       ```
   
 * I’m really lost here. I can’t pin down what’s the mistake I’m making!

Viewing 1 replies (of 1 total)