[Plugin: WP-PageNavi] PageNavi getting confused with URLs?
-
Hi,
I’m using PageNavi plugin to handle pagination in my theme. However, it looks like it’s getting confused with URLs.
The structure of my theme is as follows:
/wordpress/ – homepage
/wordpress/blog/ – blog pageThe pagination shows correctly on both the homepage and blog posts page. It works perfectly on the blog page: clicking “2” link in pagination returns /wordpress/blog/page/2 – and a second page of blog posts, of course.
However, clicking “2” link in *homepage* pagination returns (correctly) /wordpress/page/2 but the content is the same as /wordpress/blog/page/2 (second page of blog posts).
I’m using two different loops for homepage and blog page, like so:
homepage:
<?php $temp = $wp_query; $wp_query= null; $wp_query = new WP_Query('cat=-'.$blog_cat_id.'&paged=' . $paged); ?> <?php if ($wp_query->have_posts()) : ?> <?php while ($wp_query->have_posts()) : $wp_query->the_post(); ?> post stuff here <?php endwhile; if(function_exists('wp_pagenavi')) : ?> <div class="pagination"><?php if(function_exists('wp_pagenavi')) { wp_pagenavi(); } ?></div> <?php endif; $wp_query = null; $wp_query = $temp; ?>
blog page loop is basically the same except the query doesn’t have the “-” in categories, returning posts from only blog category:
$wp_query = new WP_Query('cat='.$blog_cat_id.'&paged=' . $paged);
Is there a way to fix the pagination on the homepage?
I will post the link to the theme if necessary, just ask for it if you need it, please.
- The topic ‘[Plugin: WP-PageNavi] PageNavi getting confused with URLs?’ is closed to new replies.