I recently developed a custom post type for my company's blog, so that we could have a separate press area. In the archive-presse.php page I make a query, thus :
$paged = (get_query_var('paged')) ? get_query_var('paged') : 1; //echo '<div style="display:hidden"> paged :'. $paged . "</div>"; $press_articles = new WP_Query( array( 'post_type' => 'presse', // Tell WordPress which post type we want 'paged' => $paged, 'orderby' => 'post_date', 'posts_per_page' => '10' ) );
and at the bottom, I create the navigation links :
<div class="navigation"> <div class="left"><?php previous_posts_link('« Zurück',$press_articles->max_num_pages) ?></div> <div class="right"><?php next_posts_link('Weiter »',$press_articles->max_num_pages) ?></div> </div>
(Austrian website, in case you were wondering)
On the first page, this works fine; the posts appear and so does the navigation links, which points to the second page and so on. On the third page however, when I click on 'Weiter', I end up on the 404 page, although I am sure there are still articles to be shown.
My only fix at the moment is to make sure that the posts per page is equal to a third of the total number of posts. Not much of a fix.