I’m having a tiny issue with WordPress that I can’t figure out… I just have 7 posts in the Blog Template page and I’m using this code – http://pastie.org/860191
I use query_post to show only the latest 4 posts from the category 6 but when I click the Next Posts link it shows the same 4 posts (not the rest of the posts) and the weird thing is that it shows this path blog/page/2 but I can’t see the others posts.
Here’s the page code http://pastie.org/860191 , there’s any errors in it? Am I missing something?
when you use query_posts, you need to hold the original query on a variable, then use a temp variable to hold the new query, and at the end, restore the original query…. or, use a reset query at the end: wp_reset_query();
Just like this:
<?php //The Query query_posts('posts_per_page=5'); //The Loop if ( have_posts() ) : while ( have_posts() ) : the_post(); .. endwhile; else: .. endif; //Reset Query wp_reset_query(); ?>
Maybe is that.
Shouldn’t the ‘navigation’ div with next/previous posts link be before endwhile?
You need to declare that the template is paged. See http://weblogtoolscollection.com/archives/2008/04/19/paging-and-custom-wordpress-loops/ this uses WP_query though but it can give you the overall idea.
also you should take this into consideration:
happend to me once.
Thanks a lot guys, I’ll give it a shot.