Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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();?>
share|improve this question
    
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 '12 at 17:25
add comment

marked as duplicate by Chip Bennett, toscho Dec 21 '12 at 17:26

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

2 Answers

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.

share|improve this answer
add comment

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

share|improve this answer
    
Please explain why that could solve the problem. –  toscho Dec 18 '12 at 17:48
    
I imagine the wp_reset_postdata(); breaking the pagination :) –  Satrya Dec 18 '12 at 17:56
    
Nope, that didn't work... –  Dean Elliott Dec 18 '12 at 18:55
add comment

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