I’m using multiple loops on the index of my week-old blog — three of them, in fact. Here, check out the site and I’ll explain what’s happening:
The first loop is to display just the most-recent post. I used query_post to limit the loop to the most recent and exclude all posts from a certain category:
<?php query_posts('showposts=1&cat=-4'); ?>
The second loop is directly below, to display the three most recent posts from only the category I excluded in the first loop. This, of course, is an “Asides”-type of feature. It’s specified with this code:
<?php query_posts('showposts=3&cat=4'); ?>
And the final loop just displays the rest of the posts, but again, without category 4, my Asides category:
<?php query_posts('offset=1&cat=-4'); ?>
The problem here is that when I get to the point where paging is necessary, the next pages just display the same posts as the first page. (You can’t see that in action right now because I temporarily dialed up the number of posts that display per page in order to avoid this issue.) What I want to happen is for the second page to display the next posts — minus category 4 — in the same format as the third loop in the index. No first loop, no second loop. How do I do this? All the information I’ve come across suggests that query_posts breaks paging, but I haven’t seen any fixes that pertain to my specific case.
Here’s a year-old support post that comes closest to answering my question, but still, the solution given doesn’t work:
I suspect that’s because my index is a little more complex — I have multiple query_posts statements, and each of them has more than one parameter. But I figured I’d cite it because it seems to be a start.
Can anyone help?
- The topic ‘query_posts breaks paging’ is closed to new replies.