Tabbed content with Pagination

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.

Read More
<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">&rarr;</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">&rarr;</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

Related posts

1 comment

  1. 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 than WP_navi as this would not split into sections on one page. As Follows is my new query :-

    <?php
    $cat_id = get_query_var('cat');
             $limit = get_option('posts_per_page');
             $paged1 = isset( $_GET['paged1'] ) ? (int) $_GET['paged1'] : 1;
             $the_querynew = new WP_Query('showposts=' . $limit = 45 . '&paged=' . $paged1 .'&cat=' . $cat_id . '');?> 
    

    $paged1 picking up the single pagination and then running the pagination at the bottom of the page as follows :-

    <?php  $catstring = get_query_var('cat');
    $url = get_category_link( $catstring );
    $pag_args1 = array(
    'prev_text'    => __('<'),
    'next_text'    => __('>'),
    'show_all' => true,
    'base'         => '' . $url . '?paged1=%#%',                
        'format'  => '?paged1=%#%',
        'current' => $paged1,
        'total'   => $the_querynew->max_num_pages); 
        echo paginate_links( $pag_args1 ); ?>
    

    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.

Comments are closed.