WordPress.org

Ready to get started?Download WordPress

Forums

pagination and query_posts - page numbers are more than the true count (2 posts)

  1. th90
    Member
    Posted 2 years ago #

    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. ]

  2. th90
    Member
    Posted 2 years ago #

    So another question:
    where to ask about this issue?
    any link or something that helps...?

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.