Posted By

visualadvance on 02/22/11


Tagged


Versions (?)

Wordpress: Previous Next/Post fix


 / Published in: PHP
 

URL: http://www.rizwanashraf.com/2009/01/24/wordpress-nextprevious-page-links-problem-query_post-pagination-problem/

If your getpreviousposts_link just keeps showing the same posts, chances are you need this

  1. Existing Code:
  2. <?php if(have_posts()) : ?>
  3. <?php query_posts("category_name=CategoryName"); ?>
  4. <?php while(have_posts()) : the_post(); ?>
  5.  
  6. Replace With:
  7. <?php if(have_posts()) : ?>
  8. <?php $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
  9. query_posts("category_name=CategoryName&paged=$paged"); ?>
  10. <?php while(have_posts()) : the_post(); ?>

Report this snippet  

You need to login to post a comment.