Wordpress custom post type pagination -
i trying pagination working wp pagenavi
plugin , custom post type (portfolio page) in wordpress , having no luck.
here stripped down version of 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 temp variable 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 permalinks set to:
/%postname%/
and have re-saved them.
when got page 2 of portfolio, 404 page. idea why happening?
thanks help.
i think having bad case of old wordpress url redirect.
try adding filter stop it:
add_filter('redirect_canonical','my_disable_redirect_canonical'); function my_disable_redirect_canonical( $redirect_url ) { if ( is_single( 'portfolio' ) ) $redirect_url = false; return $redirect_url; }
Comments
Post a Comment