Posted By

Farhan on 12/14/10


Tagged

wordpress pagination queryposts


Versions (?)

Who likes this?

2 people have marked this snippet as a favorite

qubestream
vagrantradio


Query Posts Pagination Problem Wordpress


 / Published in: PHP
 

URL: http://stylizedweb.com/2008/08/13/query_posts-pagination-problem/

Use this to fix Pagination Problem on query posts page. This will fix the problem where clicking on the next page keeps showing same posts

  1. <?php if (have_posts()) : ?>
  2. <?php query_posts("category_name=somecat"); ?>
  3. <?php while (have_posts()) : the_post(); ?>
  4.  
  5. replace with
  6.  
  7. <?php if (have_posts()) : ?>
  8. <?php $paged = (get_query_var('paged')) ? get_query_var('paged') : 1; query_posts("category_name=somecat&paged=$paged"); ?>
  9. <?php while (have_posts()) : the_post(); ?>

Report this snippet  

You need to login to post a comment.