I am migrating a static magazine site to wordpress. I would like to have a frontpage displaying multiple categories with a few posts in each, e.g "politics", "environment", "health" and "technology". On top of that I would like to have a "latest news" category. The posts displayed in the "latest news" category will also belong to another category (and child category e.g poltics-->asia-->india) and show up on a page with posts only from the specific category (e.g a "politics" page), but they cannot be duplicate posts on the frontpage as long as they show in the "latest news" category. The categories would be displayed in a grid magazine type design. An example of what I am trying to accomplish is this site, a well-known pirate party blog.

Can someone point me in the right direction how I would accomplish this? Basically I would need to be able to have maybe ten loops in the same page, without any duplicate posts. Very grateful for any help.

1 Answer 1


I wrote a class specifically for passing data between widgets classes using static variables and it will work for your use case as well. Grab the class here.

The way you would use this is as follows for each custom loop:

$exclude_ids  = IntermediaryData::get(); //Retrieve previous exclude IDs
$args['post__not_in'] = $exclude_ids;

//new WP_Query($args); Custom loop query

//Loop Start
     $exlude_ids[] = $post->ID,
//Loop End

IntermediaryData::set($exclude_ids); //Pass IDs to next loop
  • Thank you very much Brian. I will have a look at your suggestion. I have found a working solution at: wprecipes.com/…
    – sarytash
    Feb 5, 2012 at 2:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.