0

Possible Duplicate:
Pagination not working with custom loop

Any ideas why this paged wp_query doesn't seem to want to work?

I've tried replacing the pt_pagination function with the default next/prev posts links and that didn't work either...

<?php 
$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
$args = array (
    'post_type' => 'pt-portfolio',
    'paged' => $paged,
);
$pt_portfolio_loop = new WP_Query($args);
while($pt_portfolio_loop->have_posts()) : $pt_portfolio_loop->the_post();
?>

<?php
$cols = of_get_option('pt_portfolio_layout');
get_template_part('portfolio', $cols);
?>

<?php endwhile; ?>

<?php pt_pagination(); ?>

<?php wp_reset_postdata();?>
1
  • Please elaborate on doesn't seem to want to work. What do you expect to happen? What does or doesn't happen?
    – Rarst
    Dec 21, 2012 at 17:25

2 Answers 2

0

Try to change the pt_pagination position

<?php wp_reset_postdata();?>

<?php pt_pagination(); ?>

Or you can try Pippin code https://github.com/pippinsplugins/EDD-Starter-Theme/blob/master/front-page.php#L5-L14

3
  • Please explain why that could solve the problem.
    – fuxia
    Dec 18, 2012 at 17:48
  • I imagine the wp_reset_postdata(); breaking the pagination :)
    – Satrya
    Dec 18, 2012 at 17:56
  • Nope, that didn't work... Dec 18, 2012 at 18:55
0

Are you using any custom query before you do the 'pages' stuff? If so, try to add wp_reset_query(); or wp_reset_postdata(); before this get_query_var('paged'); code.

Not the answer you're looking for? Browse other questions tagged or ask your own question.