I've duplicated the code and settings for a WordPress theme I built that has pagination on the homepage for a new theme I'm building.
This is the code I'm using:
<?php $paged = (get_query_var('paged')) ? get_query_var('paged') : 1; ?>
<?php query_posts($query_string . '&posts_per_page=2&cat=1'); ?>
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
<h2><?php the_title() ?></h2>
<div class="meta">Posted by <?php the_author(); ?> on <?php the_time('d/m/y'); ?> | <?php comments_popup_link('0 Comments', '1 Comment', '% Comments'); ?></div>
<div class="post"><?php the_content(); ?></div>
<?php endwhile; endif; ?>
<?php if(function_exists('wp_pagenavi')) { wp_pagenavi(); } ?>
The only difference between the two websites is that on the working copy that code is in the index.php file, and on the new website, the code is in a file called homenews.php, and is called into index.php like this:
<?php if ( is_user_logged_in() ) { include(TEMPLATEPATH . '/homeboxes.php'); } else { include(TEMPLATEPATH . '/homenews.php'); } ?>
Front page displays: Latest posts
Permalinks: /%category%/%postname%
Version: 2.8.5
These are exactly the same on both installations of WordPress. Plugins are exactly the same. The pagination generates the same links (www.website.com/page/2) - yet on the new website it 404s.
Any thoughts? :/