views:

349

answers:

0

I am trying to get pagination working with the wp pagenavi plugin and a custom post type (portfolio page) in wordpress and I am having no luck.

Here is a stripped down version of my portfolio page:

<?php get_header(); ?>

<?php
  $type = 'portfolio';
  $args=array(
    'post_type' => $type,
    'post_status' => 'publish',
    'paged' => $paged,
    'posts_per_page' => 1,
    'caller_get_posts'=> 1
  );
  $temp = $wp_query;  // assign original query to temp variable for later use   
  $wp_query = null;
  $wp_query = new WP_Query($args); 
?>

<?php if($wp_query->have_posts()) : while($wp_query->have_posts()) : $wp_query->the_post(); ?>
...
<?php endwhile; else : ?>
...
<?php endif; ?>

<?php if(function_exists('wp_pagenavi')) { wp_pagenavi(); }
    $wp_query = null; $wp_query = $temp; ?>

<?php get_footer(); ?>

I have my permalinks set to:

/%postname%/

and I have re-saved them.

When I got to page two of my portfolio, I get a 404 page. Any idea why this is happening?

Thanks for the help.