Well, you’re going to have a lot of loops and a lot of custom WP_Query
objects.
To start, create an $all_posts
variable before you start the main loop on your home page. You should likely put all this in your front-page.php
template.
<?php
$all_posts = array();
while(have_posts()): the_post();
$all_posts[] = $post->ID;
// do stuff with the main loop here
endwhile;
On each subsequent loop, use the $all_posts
variable to exclude posts that already happened. Say you want to create loops for the categories with the term_id
‘s 1
, 2
, and 3
:
<?php
foreach(array(1, 2, 3) as $cat))
{
$cat_query = new WP_Query(array(
'cat' => $cat,
'post__not_in' => $all_posts,
));
if($cat_query->have_posts()
{
while($cat_query->have_posts())
{
$cat_query->the_post();
$all_posts[] = $post->ID;
// display stuff here
}
}
}
Just keep appending post IDs to the $all_posts
variable to make sure subsequent queries don’t include posts that were already seen.