For some reason, the ‘previous posts’ and ‘next posts’ on the homepage do not load previous posts, but rather the same posts that were on the main page.
Why is that? I don’t even know where to start debugging…
I have the following code snippets that might be related in the loop.php
file:
if ( is_home() ) {
query_posts($query_string . '&cat=-13,');
}
while ( have_posts() ) : the_post(); ?>
// This following line added to exclude posts that have custom variable ad=true:
<?php if ( get_post_meta($post->ID, 'ad', true) == '') { ?>
…there here are the posts displaying…
<?php } // Ending the exlusion of 'ad' ?>
<?php endwhile; // End the loop. Whew. ?>
<?php if ( $wp_query->max_num_pages > 1 ) : ?>
<div id="nav-below" class="navigation">
<div class="nav-previous"><?php next_posts_link( __( '<span class="meta-nav">←</span> ÐÑедиÑни ÑÑаÑии', 'twentyten' ) ); ?></div>
<div class="nav-next"><?php previous_posts_link( __( 'СледваÑи ÑÑаÑии <span class="meta-nav">→</span>', 'twentyten' ) ); ?></div>
</div><!-- #nav-below -->
<?php endif; ?>
Where else could the problem be, if not in those snippets? How could I debug it?
Are you using
'posts_per_page'
and'paged'
in the query string? if not try to addNumber 5 will be replaced with the number of posts after which you want the next page (pagination) link to show up.
Also remove the if statement on the next page link
if ( $wp_query->max_num_pages > 1 )
It’s because your homepage is using it’s own query_posts call, and that query_posts call is bringing back all posts from a specific category. Since that is the only restriction in place it will always retrieve and display the same posts.