query_posts isnt working with next_posts_link
-
Hi,
I’m in the middle of making my archive.php page for my template. The way I’m organizing my data is that there will be 2 parent categories for all the other categories: ‘blog’and ‘portfolio’. I basically want it so that on the blog page, only posts of categories who’s parent is ‘blog’ are shown, and same for portfolio.
I got this working just fine by using this code:
global $wp_query; query_posts( array_merge( array('category_name' => 'Blog'), $wp_query->query ) );
so that it merges the previous query and adds the request to only show entries with a category name ‘blog’.
Here’s the problem. I wanted to test out how it looked with multiple pages of posts, so I set my posts per page (in the Dashboard settings > Reading) to 2. Right now I have 4 posts with categories with the ‘Blog’ parent and 3 with ‘Porfolio’.
In my section where I have the tags previous_posts_link() and next_posts_link(), it’s actually giving me 4 pages until my “Older Entries” button disappears. Those last 2 pages, though, are empty (besides everything outside of The Loop). It’s accommodating for all 7 posts for some reason. Is there any way to make previous_posts_link() and next_posts_link() react correctly to my new query?
I hope I explained this correctly. Thanks for your help!
David
- The topic ‘query_posts isnt working with next_posts_link’ is closed to new replies.