Support » Themes and Templates » 404s beyond page 2

  • Resolved lukeshumard


    I’m pulling my hair out trying to get pagination to work on my site. My pagination shows up, and works when I edit the variables for ‘posts_per_page’ in my query. However, it will only show the first and second page, and the third ( is always a 404 error. My permalink structure is set up to /%year%/%monthnum%/%day%/%postname%/. I have WP-Paginate installed, here is my code for index.php.

    		$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
    		$args= array(
    					 'cat' => 1,
    					 'posts_per_page' => 1,
    					 'paged' => $paged
    					 ); ?>
    	<?php query_posts($args); ?>
    	<?php if (have_posts()) : ?>
        	<?php while (have_posts()) : the_post(); ?>
            <div class="post">
            <h2><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2>
            <small><?php the_time('F jS, Y') ?></small>
    			<div class="entry">
    			<?php the_content(); ?>
            <div class="divide"></div>
        <?php endwhile; ?>
        	<?php if(function_exists('wp_paginate')) { wp_paginate(); } ?>
        <?php else: endif; ?>

    The only other plugins I have installed are GigPress, Contact Form 7, and WP No Category Base (which I’ve tried deactivating in case that did anything).

    I am completely stumped, and can’t help but wonder if I’m overlooking something incredibly simple. I’ve searched through a few threads slightly similar to this, but I couldn’t find a straight answer. Anyone?

Viewing 2 replies - 1 through 2 (of 2 total)
  • That is really strange.

    Have you tried printing out $args to see if something is changing?

    I think you’d have to investigate on a lower level to see what is going on. As far as I can tell, the plugin is doing what it is supposed to…

    Thread Starter lukeshumard


    the solution to this was this code…

    $limit = get_option('posts_per_page');
    $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
    query_posts('showposts=' . $limit . '&paged=' . $paged .'&cat=1');
    $wp_query->is_archive = false;
    $wp_query->is_home = true;

    …and that worked for me. i forget what page that information came from.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘404s beyond page 2’ is closed to new replies.