[Resolved] 2 loops not behaving. Count is off
There’s a paste of the code I’m working with. The one thing I’ve never done in WP until now, is work with multiple queries. I’ve exhausted my knowledge, and reading got me this far…. but I’m stuck.
There’s 2 loops. The first loop should show either a sticky post if it exists, or the most recent post if no sticky. Only 1 post should show.
Notice the query for the second loop is inside a conditional. The second loop should show 9 posts, excluding stickies, excluding the post that appears in loop 1, on the home page. Outside of the home page, the query should not apply, so I should just get my normal 10 posts.
I’m almost there, but my count is off. EVen though I’m asking for 1+9 posts on the home page, I’m getting 1+7. The rest of the behaviour is correct as far as handling stickies and not duplicating.
On the subsequent paginated pages I’m getting 9 posts when I want 10.
Any idea what is throwing off my post count? I need to get it reliable and specific for my new layout.
Is it due to excluding the stickies and dupes that throws the count off, if so, how can I account for this?
Thanks in advance! (I know the code isn’t pretty. I hack things together as I read, and once everything works, I’ll go back through and make it nice and pretty)
- The topic ‘[Resolved] 2 loops not behaving. Count is off’ is closed to new replies.