Support » Fixing WordPress » Multiple loops; no duplicates entirely

  • Resolved michaelcollado


    Hey! I’m building a new homepage loop for a child theme (based off TwentyTen, yes) that’s a bit more Magazine-ish. (The site I’m running is a TV review site, just so it can be easier to understand category titles.)

    As such, there are about four areas of posts. The top is just one featured post, below it are two columns with about five different posts, respectively, from separate categories (however these amount to about four loops because it’s one image and heading and then four just-headlines), and then a final loop below all of it which is just a standard archive of latest posts.

    My problem is duplicate posts. I want to get rid of them across the board (except maybe the latest posts) but can’t figure it out. Using what I found in the codex, if the most recent post is a featured post but also in a category for one of the columnized loops, then it just disappears from the column. That’s good, but it doesn’t replace it with the next post…which is sort of what I’m looking for. I don’t want a blank space!

    I hope some of this makes any sense. Here’s a pastebin of my loop code:

    Any help would be greatly appreciated! (I’m also trying to figure out pagination, but that’s for another post!)

Viewing 4 replies - 1 through 4 (of 4 total)
  • Michael


    Forum Moderator

    particular the section after this headline ‘Note for Multiple Posts in the First Category’

    i.e. using an array for $do_not_duplicate and the method with 'post__not_in' parameter in the queries.

    Thanks, I implemented the different code for the loops with multiple categories! 🙂 However, my real issue still persists. Is there no way for the loop to access the next post if one is already in use? For example, my final loop should show 8 posts, but since there are already 5 posts showing in other loops before it, it just shows 3. I want it to skip that post that’s already shown but still show 8.



    Forum Moderator

    read the lines and examples after this headline ‘Note for Multiple Posts in the First Category’ within this Codex chapter:

    Thanks alchymyth, I read that document and implemented the codes endlessly but just couldn’t get the results I wanted. HOWEVER I DID solve the problem. If anyone has my same issue, you can have a look at how I set up my loop, which is paginated with only the final loop.

    I forgot where I found it but it saved my life. I really know someone can benefit from it! 🙂

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Multiple loops; no duplicates entirely’ is closed to new replies.