After a lot of digging and trial-error I think I found a solution.
It involves custom fields for which I used Advanced Custom Field but it’s optional.
To make things easy on the site author I put a metabox before the actual news
Now, in my homepage I have 5 areas: 4 of them contains just one news and the 5th is a “other news” box with ten new.
So the first 4 boxes are pretty easy:
$recentPosts = new WP_Query();
$recentPosts->query(array(
'meta_key' => 'position',
'meta_value' => 'Top1',
'showposts' => 1
)
);
with the meta value with the correct position I need.
The main issue was: how can I push older “Top1” news into the “other news” box without having to manually switch the custom field?
$top1 = get_posts(array(
'meta_key' => 'position',
'meta_value' => 'Top1',
'offset' => 1
));
$top2 = get_posts(array(
'meta_key' => 'position',
'meta_value' => 'Top2',
'offset' => 1
));
$top3 = get_posts(array(
'meta_key' => 'position',
'meta_value' => 'Top3',
'offset' => 1
));
$top4 = get_posts(array(
'meta_key' => 'position',
'meta_value' => 'Top4',
'offset' => 1
));
$other = get_posts(array(
'meta_key' => 'position',
'meta_value' => 'Other news'
));
$mergedposts = array_merge( $top1, $top2, $top3, $top4, $other );
$postids = array();
foreach( $mergedposts as $item ) { $postids[]=$item->ID; }
$uniqueposts = array_unique($postids);
$posts = get_posts(array(
'post__in' => $uniqueposts,
'showposts' => 3
));
foreach( $posts as $post ) :
setup_postdata($post);
Maybe the code could be cleaned up a bit, but it works as I needed.
I hope that’s useful.