Title: older posts in changed loop, posts_nav_link
Last modified: August 19, 2016

---

# older posts in changed loop, posts_nav_link

 *  Resolved [matek12345](https://wordpress.org/support/users/matek12345/)
 * (@matek12345)
 * [16 years ago](https://wordpress.org/support/topic/older-posts-in-changed-loop-posts_nav_link/)
 * Hi,
 * I’m building a site, and i have caught a problem.
 * I want to display posts in the loop and i want to show only one category posts,
 * I have modified loop that only one category displays, it’s on template page,
 * My problem is that i want to display on one page only 6 posts and have the option
   to navigate to older posts but in this category.
 * I tried the posts_nav_link() but it doesn’t work, i read that’s because if i 
   change default behaviour of the loop (like query_posts, get_post etc.) the next/
   prev doesn’t work.
 * So my question is, is there some way, method, maybe plugin that i can display
   this navigation to older post.
 * Thanks

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

 *  [esmi](https://wordpress.org/support/users/esmi/)
 * (@esmi)
 * [16 years ago](https://wordpress.org/support/topic/older-posts-in-changed-loop-posts_nav_link/#post-1497100)
 * You need to amend the custom query to take account of multiple pages. Eg:
 *     ```
       <?php
       $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
       $args= array(
       	'posts_per_page' => 6,
       	'category_name' => 'News',
       	'paged' => $paged
       );
       query_posts($args);
       ?>
       ```
   
 *  Thread Starter [matek12345](https://wordpress.org/support/users/matek12345/)
 * (@matek12345)
 * [16 years ago](https://wordpress.org/support/topic/older-posts-in-changed-loop-posts_nav_link/#post-1497120)
 * thanks for answer, and help, but it doesn’t work,
 * maybe i will give the code that i have on my site, i tried many things, i tried
   this [http://theodin.co.uk/blog/design/wordpress-pagination-wppagenavi-queryposts.html](http://theodin.co.uk/blog/design/wordpress-pagination-wppagenavi-queryposts.html)
   and one thing that now when i type in my url after whole url number eg: /2 i 
   get the second page,
 * i also tried this [http://weblogtoolscollection.com/archives/2008/04/13/define-your-own-wordpress-loop-using-wp_query/](http://weblogtoolscollection.com/archives/2008/04/13/define-your-own-wordpress-loop-using-wp_query/)
   but this doesn’t work at all,
 * I really don’t know where the problem is, and how to get it working, i really
   need this,
 * i also tried with this plugin wp=pagenavi, but it only works on first site,
 * that is my code after this first article adjust
 * [http://wordpress.pastebin.com/eLMrKjrX](http://wordpress.pastebin.com/eLMrKjrX)
 * and this is before this first article adjustment, just the loop with category
   that i want to include
 * [http://wordpress.pastebin.com/gEzyP5V4](http://wordpress.pastebin.com/gEzyP5V4)
 * Thanks a lot for help :]
 *  Thread Starter [matek12345](https://wordpress.org/support/users/matek12345/)
 * (@matek12345)
 * [16 years ago](https://wordpress.org/support/topic/older-posts-in-changed-loop-posts_nav_link/#post-1497236)
 * Ok i used your code, man thank so much, i just have to adjust it a little, but
   it works, my code looks like this:
 *     ```
       <div>
       			<?php
       				//The Query
       				$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
       $args= array(
       	'posts_per_page' => 3,
       	'category_name' => 'czytelnia',
       	'paged' => $paged
       );
       query_posts($args);
       				 while ( have_posts() ) : the_post();
       			?>
       			<div class="box4" id="post-<?php the_ID(); ?>">
   
       				<div class="title4">
       					<?php $preview = get_post_meta($post->ID, 'preview', $single = true); ?>
       					<h2><a href="<?php the_permalink() ?>" title="<?php the_title(); ?>"><?php the_title(); ?></a></h2>
       				</div>
       				<div class="sentry4">
       					<?php $preview = get_post_meta($post->ID, 'preview', $single = true); ?>
       					<img class="ethumb4" src="<?php bloginfo('stylesheet_directory'); ?>/timthumb.php?src=<?php echo $preview; ?>&h=100&w=290&zc=1" alt=""/> 
   
       					<?php the_excerpt(); ?>
       						<div class="clear"></div>
       				</div>
       							<div class="sinfo4">
   
       				<div class="rmore4"><a href="<?php the_permalink() ?>" title="Permanent Link to <?php the_title(); ?>"> Więcej... </a></div>
   
       			</div>
       			</div>
       			<?php endwhile; ?>
   
       <div style="text-align:center;">
       <?php posts_nav_link(); ?>
       </div>
   
       		</div>
   
       </div>
       ```
   
 * thanks

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

The topic ‘older posts in changed loop, posts_nav_link’ is closed to new replies.

## Tags

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

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 3 replies
 * 2 participants
 * Last reply from: [matek12345](https://wordpress.org/support/users/matek12345/)
 * Last activity: [16 years ago](https://wordpress.org/support/topic/older-posts-in-changed-loop-posts_nav_link/#post-1497236)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
