Warning: Please do not give out any FTP or ssh credentials to anyone, unless you trust them completely. Giving out login details is dangerous.
If the asker does not get an answer then they have 10 days to request a refund.
$4
Why Pagination is not working on Category.php
<?php get_header(); ?>
<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>'; } ?>
<?php get_footer(); ?>
Sarbartha Das | 05/04/11 at 9:39am
Edit
The experts have suggested, on average, a prize of $4 for this question.
(4) Possible Answers Submitted...
Note: Sarbartha Das felt their question was unanswered, so we granted them a refund.
Note: Sarbartha Das requested a refund. They offered this explanation:
"Nobody answered the question properly.."If no one challenges a refund request, then they are automatically granted and proccessed after 48 hours. Admins of this site only review refund requests if someone challenges the request. If you are curious about how we handled previous refund requests, you may read over all refund requests and their challenges.
See a chronological view of answers?
Warning: Please do not give out any FTP or ssh credentials to anyone, unless you trust them completely. Giving out login details is dangerous.
-

Last edited:
05/04/11
9:55amPippin Williamson says:Try changing your first query to this:
$global $query_string;
WP_Query($query_string . "&posts_per_page=10&category_name=life-sciences&paged=".$paged);
- 05/04/11 11:38am
Sarbartha Das says:Sorry!
Not working..
- 05/04/11 11:48am
Pippin Williamson says:Ok, try replacing
$the_query = new WP_Query("posts_per_page=10&category_name=life-sciences&paged=".$paged);
with:
$global $query_string;
query_posts($query_string . "&posts_per_page=10&category_name=life-sciences&paged=".$paged);
and then replace
<?php $count=0; while ( $the_query->have_posts() ) : $the_query->the_post(); ?>
with
<?php $count=0; while ( have_posts() ) : the_post(); ?>
- 05/04/11 12:15pm
Sarbartha Das says:Sorry!
Not working..
- 05/04/11 11:38am
-

Last edited:
05/04/11
4:51pmDavid Navarrete says:you could will try with this
global $wp_query;
and use query_posts instead of WP_Query
- 05/04/11 10:00pm
Sarbartha Das says:"Sorry" this thing is not working..
Breaking the code when next page browsed...
There are two different category "Life Sciences" and "General Lab" and there are sub-categorical product on "Life Sciences".
Now in "General Lab" has all the sub-category and products which "Life sciences" have. Same product.
- 05/04/11 10:00pm
-

Last edited:
05/04/11
11:10pmLuthfi Bintoro says:try this :
change the code :
$the_query = new WP_Query("posts_per_page=10&category_name=life-sciences&paged=".$paged); ?>
with :
query_posts("posts_per_page=10&category_name=life-sciences&paged=".$paged);
global $wp_query;
?>
and then change :
<?php if ( $the_query->max_num_pages > 1 ) : ?>
with
<?php if ( $wp_query->max_num_pages > 1 ) : ?>
hope this help -

Last edited:
05/05/11
2:51amDenzel Chia says:Hi,
With reference to WordPress Template hierarchy. http://codex.wordpress.org/Template_Hierarchy
Why don't you try using different category templates.
category-{slug}.php - If the category's slug were general-lab, WordPress would look for category-general-lab.php
Use a normal WordPress loop in the template and your pagination issues will be solved.
Use category.php for your other categories and use category-{slug}.php for all special categories that you want to have different styles or codes or highlights.
Thanks.
Denzel
This question has expired.
Current status of this question: Refunded
Warning: Please do not give out any FTP or ssh credentials to anyone, unless you trust them completely. Giving out login details is dangerous.
If the asker does not get an answer then they have 10 days to request a refund.
