WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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.

share|improve this question
up vote 1 down vote accepted

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
share|improve this answer
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 '12 at 2:39

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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