There are two different category "Life Sciences" and "General Lab" and there are sub-categorical product on "Life Sciences".
Now "General Lab" category want to fetch all the sub-category and products which "Life sciences" have. The code is in category.php.
Here is the whole code:
<div id="container"> <div id="content" role="main"> <?php if ( is_category('general-lab') ) : ?> <?php //FETCHING ONLY GENERAL LAB CATEGORY $paged = (get_query_var('paged')) ? get_query_var('paged') : 1; $the_query = new WP_Query("posts_per_page=10&category_name=life-sciences&paged=".$paged); ?> <h1 class="entry-title"><?php echo single_cat_title("", TRUE); ?></h1> <?php $count=0; while ( $the_query->have_posts() ) : $the_query->the_post(); ?> <?php if($count % 2 == 0) echo '<div class="left">'; else echo '<div class="right">'; ?> <div id="post-<?php the_ID(); ?>" <?php post_class(); ?>> <div class="cat-thumb"><?php echo get_post_meta($post->ID, '_mcf_block-one', true); ?></div> <div class="cat-entry"> <h2 class="entry-title"><a href="<?php the_permalink(); ?>" title="<?php printf( esc_attr__( 'Permalink to %s', 'twentyten' ), the_title_attribute( 'echo=0' ) ); ?>" rel="bookmark"><?php the_title(); ?></a></h2> <?php the_excerpt(); ?> </div> </div> </div> <?php if($count % 2 != 0) echo '<div class="clear"></div>';?> <?php $count++; endwhile; ?> <?php if ( $the_query->max_num_pages > 1 ) : ?> <div id="nav-below" class="navigation"> <div class="nav-previous"><?php previous_posts_link( __( '<span class="meta-nav">←</span> Previous', 'twentyten' ) ); ?></div> <div class="nav-next"><?php next_posts_link( __( 'Next <span class="meta-nav">→</span> ', 'twentyten' ) ); ?></div> </div><!-- #nav-below --> <?php endif; ?> <?php else : ?> <h1 class="entry-title"><?php echo single_cat_title("", TRUE); ?></h1> <?php $count=0; while (have_posts()) : the_post(); ?> <?php if($count % 2 == 0) echo '<div class="left">'; else echo '<div class="right">'; ?> <div id="post-<?php the_ID(); ?>" <?php post_class(); ?>> <div class="cat-thumb"><?php echo get_post_meta($post->ID, '_mcf_block-one', true); ?></div> <div class="cat-entry"> <h2 class="entry-title"><a href="<?php the_permalink(); ?>" title="<?php printf( esc_attr__( 'Permalink to %s', 'twentyten' ), the_title_attribute( 'echo=0' ) ); ?>" rel="bookmark"><?php the_title(); ?></a></h2> <?php the_excerpt(); ?> </div> </div> </div> <?php if($count % 2 != 0) echo '<div class="clear"></div>';?> <?php $count++; endwhile; ?> <?php if ( $wp_query->max_num_pages > 1 ) : ?> <div id="nav-below" class="navigation"> <div class="nav-previous"><?php previous_posts_link( __( '<span class="meta-nav">←</span> Previous', 'twentyten' ) ); ?></div> <div class="nav-next"><?php next_posts_link( __( 'Next <span class="meta-nav">→</span> ', 'twentyten' ) ); ?></div> </div><!-- #nav-below --> <?php endif; ?> <?php endif; ?> </div><!-- #content --> </div><!-- #container --> <?php $current_category = single_cat_title("", FALSE); $parent_cat = get_the_category(); $back_to_current = get_cat_name($parent_cat[0]->category_parent); if ( is_category( array( 'life-sciences','consumables','histology','forensics','pharmaceutical' ) ) == $current_category) { ?> <?php echo '<div id="cat-menu"><h3>'.$back_to_current.'</h3>'; wp_nav_menu( array('container_id' => 'sub-page', 'menu' => $current_category ) ); echo '</div>'; } elseif ( is_category('general-lab')) { ?> <?php echo '<div id="cat-menu"><h3>'.$current_category.'</h3>'; wp_nav_menu( array('container_id' => 'sub-page', 'menu' => $back_to_current ) ); echo '</div>'; } else { ?> <?php echo '<div id="cat-menu"><h3>'.$back_to_current.'</h3>'; wp_nav_menu( array('container_id' => 'sub-page', 'menu' => $back_to_current ) ); echo '</div>'; } ?>
get_query_var('paged')
should beget_query_var('page')
as of v3.0.2.