I’ve stumble across an issue on a site Im building. I have tabbed content each holding a category for price ranges in seprate loops. The tabs work great filtering the categories, however some of the posts now have WP page-navi running the pagination, again works fine.
However if I paginate to /page/2 on the first tab the other tabs are then blank/contentless. I can only assume this is a url problem in the pagination so loops are not grabbing the content or I’m not running the loops correctly.
<div id="tabs-1">
<?php
$cat_id = get_query_var('cat');
$limit = get_option('posts_per_page');
$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
query_posts('showposts=' . $limit = 12 . '&paged=' . $paged .'&cat=' . $cat_id . '');
$wp_query->is_archive = true; $wp_query->is_home = false;
?>
<?php if (have_posts()) : ?>
<?php while (have_posts()) : the_post(); ?>
<div class="child-cat-wrap">
<div class="child-cat-cont title-slide">
<a href="<?php the_permalink() ?>">
<div class="title"><span><?php the_title(); ?></span>Read More</div>
<?php the_post_thumbnail( 'Full Size' ); ?>
</a>
</div>
<?php echo get_new_excerpt() . '...'; ?>
<a href="<?php the_permalink(); ?>">more info <span class="meta-nav">→</span></a>
</div>
<?php endwhile; ?>
<?php wp_pagenavi(); ?>
<?php endif ?>
</div>
<div id="tabs-2">
<?php
$cat_id = get_query_var('cat');
$limit = get_option('posts_per_page');
$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
query_posts('showposts=' . $limit = 12 . '&paged=' . $paged .'&cat=-16,-17,' . $cat_id . '');
$wp_query->is_archive = true; $wp_query->is_home = false;
?>
<?php if (have_posts()) : ?>
<?php while (have_posts()) : the_post(); ?>
<div class="child-cat-wrap">
<div class="child-cat-cont title-slide">
<a href="<?php the_permalink() ?>">
<div class="title"><span><?php the_title(); ?></span>Read More</div>
<?php the_post_thumbnail( 'Full Size' ); ?>
</a>
</div>
<?php echo get_new_excerpt() . '...'; ?>
<a href="<?php the_permalink(); ?>">more info <span class="meta-nav">→</span></a>
</div>
<?php endwhile; ?>
<?php wp_pagenavi(); ?>
<?php endif ?>
</div>
Any information on this is even possible or a kick in the right direction would be greatly appreciated.
To see the example of the of page I’m testing
Ok solved,
I managed to run a query for each post as a
WP_Query
instead as Brasofilo pointed out. Then built in the custom pagination via wordpresses help rather thanWP_navi
as this would not split into sections on one page. As Follows is my new query :-$paged1
picking up the single pagination and then running the pagination at the bottom of the page as follows :-So simply re running the same query for different posts but running a different variable for the
WP_query
and$paged1
will give you the correct result.