WordPress.org

Support

Support » Themes and Templates » pagination and query_posts – page numbers are more than the true count

pagination and query_posts – page numbers are more than the true count

  • Hi.
    I’ve a problem with using pagination and paged template while using query_posts to show posts from just a specific category .
    I’ve a source like this :

    <?php
    		$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
    		query_posts( 'category_name= TEST&paged=' . $paged );
    	?>
    	<?php if (have_posts()) : while (have_posts()) : the_post(); ?>

    and the nav area like this :

    <?php
    				$pagenum = $wp_query->max_num_pages;
    				if ( $pagenum > 1 ) : ?>
    				<div id="pagesnav">
    					<div id="nav_previous"><?php next_posts_link( __( 'next page' ) ); ?></div>
    					<div class="nav_next"><?php previous_posts_link( __( 'prev page' ) ); ?></div>
    </div>
    <?php endif; ?>

    problem is the calculation for number of pages that wordpress does.
    it calculates count of pages based on whole post in all of categories.
    and then it generates pages more than the true count.
    and it shows blank pages after when the posts of specified category is finished.

    how to fix this problem.
    thanks.

    [ Please do not bump, it’s not permitted here. ]

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘pagination and query_posts – page numbers are more than the true count’ is closed to new replies.