Title: Recent posts with paginator problem &#8211; help!
Last modified: August 19, 2016

---

# Recent posts with paginator problem – help!

 *  [choazie](https://wordpress.org/support/users/choazie/)
 * (@choazie)
 * [15 years, 3 months ago](https://wordpress.org/support/topic/recent-posts-with-paginator-problem-help/)
 * Hi there, I have sort of a noob problem with displaying posts in terms of pagination–
   the way I have my page set up, the same 5 recent posts are always displayed on
   each page. What I want is to display the 5 most recent posts (with content) and
   a paginator to see older posts.
 * I’m doing something very basic wrong here with the loop or post displaying but
   I’m not sure what it is, so any help would be greatly appreciated.
 * Here’s the page: [http://www.ratethishunk.com/latest-hunk](http://www.ratethishunk.com/latest-hunk)(
   apologies for making you look at shirtless hunks, guys 🙂
 * Here’s the code:
 *     ```
       <?php query_posts('category_name=Uncategorized&posts_per_page=5'); ?>
   
       <?php while (have_posts()) : the_post(); ?>
   
       <div id="post-<?php the_ID(); ?>" class="latest">
   
       <div class="latest1">
       <span><a href="<?php the_permalink() ?>" rel="bookmark" title="permanent link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></span>
       </div>
   
       <div class="latest2">
       <span><small>added <?php the_time('F jS, Y') ?></small></span>
       </div>
   
       <div class="latest3">
       <?php wp_gdsr_render_article() ?>
       </div>
   
       <div class="clear" style="height:30px"></div>
   
       <br clear="all" />
   
       <?php the_content(); ?>
   
       </div>
   
       <?php endwhile; ?>
   
       <br />
   
       <?php if(function_exists('wp_paginate')) {
           wp_paginate();
       } ?>
       ```
   
 * (I know the code is a bit messy, sorry)
 * Thanks!

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

 *  [Michael](https://wordpress.org/support/users/alchymyth/)
 * (@alchymyth)
 * [15 years, 3 months ago](https://wordpress.org/support/topic/recent-posts-with-paginator-problem-help/#post-1877274)
 * if you want pagination, you need to add the ‘paged’ parameter to your query:
 * i.e. change from what you have:
 *     ```
       <?php query_posts('category_name=Uncategorized&posts_per_page=5'); ?>
       ```
   
 * to something like this:
 *     ```
       <?php $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
       query_posts('category_name=Uncategorized&posts_per_page=5&paged=' . $paged); ?>
       ```
   
 * [http://codex.wordpress.org/Function_Reference/query_posts#Pagination_Parameters](http://codex.wordpress.org/Function_Reference/query_posts#Pagination_Parameters)
 * there seems to be some change going on at the moment, so if this does not work,
   try to change `get_query_var('paged')` to `get_query_var('page')` in the above
   code.
 *  Thread Starter [choazie](https://wordpress.org/support/users/choazie/)
 * (@choazie)
 * [15 years, 3 months ago](https://wordpress.org/support/topic/recent-posts-with-paginator-problem-help/#post-1877529)
 * Wow, that completely worked! Can’t tell you how much I appreciate your help –
   I love this forum 🙂
 *  [ryansebiz](https://wordpress.org/support/users/ryansebiz/)
 * (@ryansebiz)
 * [15 years, 2 months ago](https://wordpress.org/support/topic/recent-posts-with-paginator-problem-help/#post-1877624)
 * Awesome – thanks alc!
 *  [Ryan Martin](https://wordpress.org/support/users/mufatcha/)
 * (@mufatcha)
 * [14 years, 11 months ago](https://wordpress.org/support/topic/recent-posts-with-paginator-problem-help/#post-1877641)
 * Perfect! This was driving me crazy all morning.

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

The topic ‘Recent posts with paginator problem – help!’ is closed to new replies.

## Tags

 * [loop](https://wordpress.org/support/topic-tag/loop/)
 * [pagination](https://wordpress.org/support/topic-tag/pagination/)
 * [query_posts](https://wordpress.org/support/topic-tag/query_posts/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 4 replies
 * 4 participants
 * Last reply from: [Ryan Martin](https://wordpress.org/support/users/mufatcha/)
 * Last activity: [14 years, 11 months ago](https://wordpress.org/support/topic/recent-posts-with-paginator-problem-help/#post-1877641)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
