Posted By

Ben on 03/03/10


Tagged

wordpress query pagination


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

BrianCoyDesign


Wordpress pagination on a query


 / Published in: PHP
 

  1. <?php
  2. $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
  3. query_posts('posts_per_page=3&paged=' . $paged . '');
  4. ?>
  5.  
  6. <?php if (have_posts()) :
  7. $my_query = new WP_Query('category_name=testcat'.'&paged='.$paged 'posts_per_page=3');
  8. while ( $my_query->have_posts() ) : $my_query->the_post();
  9. ?>
  10.  
  11. <?php if (have_posts()) : ?>
  12. <?php $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
  13. query_posts("category_name=testcat&paged=$paged&posts_per_page=3"); ?>
  14. <?php while (have_posts()) : the_post(); ?>

Report this snippet  

You need to login to post a comment.