WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Archived and Categories not being paginated correctly (11 posts)

  1. azn137
    Member
    Posted 3 years ago #

    Here's my site: http://tambnguyen.com/, and I'm using WP 3.1 with WP-PageNavi 2.74.

    My problem is when view the site under either Categories or Archives, the pagination is not working correctly. For example, in Feb 2011, I posted 12 entries. When viewing http://tambnguyen.com/2011/02/, it only shows the first page. When clicking on the second page (http://tambnguyen.com/2011/02/page/2/), I get a soft 404. The same thing happens when viewing the categories.

    I've tried disabling all the plugins to the bare minimum, and yet still have that problem. Currently, I have DB Cache Reloaded, W3 Total Cache (Minify, Object cache, Browser cache and CDN enabled).

    Here's my index.php:

    <?php if (is_archive()) $post_number = get_option('polished_archivenum_posts');
    if (is_search()) $post_number = get_option('polished_searchnum_posts');
    if (is_tag()) $post_number = get_option('polished_tagnum_posts'); ?>
    <?php get_header(); ?>
    
    	<?php global $query_string; query_posts($query_string . "&showposts=$post_number&paged=$paged"); ?>
    
    	<div id="wrap">
    	<!-- Main Content-->
    		<img src="<?php bloginfo('template_directory');?>/images/content-top.gif" alt="content top" class="content-wrap" />
    		<div id="content">
    			<!-- Start Main Window -->
    			<div id="main">
    
    				<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
    
    					<?php include(TEMPLATEPATH . '/includes/entry.php'); ?>
    
    				<?php endwhile; ?>
    
    					<?php if(function_exists('wp_pagenavi')) { wp_pagenavi(); }
    					else { ?>
    						<?php include(TEMPLATEPATH . '/includes/navigation.php'); ?>
    					<?php } ?>
    
    				<?php else : ?>
    					<?php include(TEMPLATEPATH . '/includes/no-results.php'); ?>
    				<?php endif; wp_reset_query(); ?>
    			</div>
    			<!-- End Main -->
    <?php get_sidebar(); ?>
    <?php get_footer(); ?>

    and here's my category.php

    <?php get_header(); ?>
    
    	<div id="wrap">
    	<!-- Main Content-->
    		<img src="<?php bloginfo('template_directory');?>/images/content-top.gif" alt="content top" class="content-wrap" />
    		<div id="content">
    			<!-- Start Main Window -->
    			<div id="main">
    				<?php global $query_string; $catnum_posts = get_option('polished_catnum_posts') ;
    			query_posts($query_string . "&showposts=$catnum_posts&paged=$paged&cat=$cat"); ?>
    				<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
    
    					<?php include(TEMPLATEPATH . '/includes/entry.php'); ?>
    
    				<?php endwhile; ?>
    
    					<?php if(function_exists('wp_pagenavi')) { wp_pagenavi(); }
    					else { ?>
    						<?php include(TEMPLATEPATH . '/includes/navigation.php'); ?>
    					<?php } ?>
    
    				<?php else : ?>
    					<?php include(TEMPLATEPATH . '/includes/no-results.php'); ?>
    				<?php endif; wp_reset_query(); ?>
    			</div>
    			<!-- End Main -->
    
    	<?php get_sidebar(); ?>
    
    <?php get_footer(); ?>

    Please take a look and thanks for your help guys.

  2. azn137
    Member
    Posted 3 years ago #

    bump! can someone help me with this please?

  3. azn137
    Member
    Posted 3 years ago #

    Okay, I've tried disabling ALL plugins, and I still have that problem. Any taker?

    Thanks!

  4. azn137
    Member
    Posted 3 years ago #

    Okay, O was able to fix the pagination issue by modifying my index code:

    from:

    <?php global $query_string; query_posts($query_string . "&showposts=$post_number&paged=$paged"); ?>

    to

    <?php global $query_string; query_posts($query_string . "&showposts=" . get_query_var( 'posts_per_page' ) . "&paged=" . get_query_var( 'page' )); ?>

    Although, my next problem is, on the last page, it doesn't display the PageNavi stuff. Here's an example:

    http://tambnguyen.com/category/categories/technology/page/2/

    Thanks guys!

  5. lovefortech@gmail.com
    Member
    Posted 3 years ago #

    Hey,

    I am using thesis with wp-navi and the archive pages are not showing pagination.....any idea why? Should I post any code here?

    Cheers!

  6. azn137
    Member
    Posted 3 years ago #

    Did you modify the theme's index page like I posted?

  7. Frederick Townes
    Member
    Posted 3 years ago #

    :bump:

  8. azn137
    Member
    Posted 3 years ago #

    If you theme's option has the ability to change the number of posts per page, make sure that number matches with your WP option Settings >> Reading >> Blog pages show at most.

    Hope that helpes.

  9. Frederick Townes
    Member
    Posted 3 years ago #

    Anyone having further issue here?

  10. azn137
    Member
    Posted 3 years ago #

    Not me, I've got it resolved. And apparently I couldn't spell for the life of me!

  11. Frederick Townes
    Member
    Posted 2 years ago #

    Ok, thanks.

Topic Closed

This topic has been closed to new replies.

About this Topic