Posted By

rickfu on 05/18/11



Viewed 404 times
Favorited by 0 user(s)

query_posts() Pagination problem |

/ Published in: PHP
Save to your folder(s)

Replace standard query_posts with the snippet to enable pagination on pages with a custom loop. Be sure to change out "somecat" with your category or add additional query arguments.

Copy this code and paste it in your HTML
  1. <?php if (have_posts()) : ?>
  2. <?php $paged = (get_query_var('paged')) ? get_query_var('paged') : 1; query_posts("category_name=somecat&paged=$paged"); ?>
  3. <?php while (have_posts()) : the_post(); ?>


Report this snippet


RSS Icon Subscribe to comments

You need to login to post a comment.