I have several categories on my wp site.
On the front page I want to make sections for all of existing categories and than output 4 most recent articles from each of the category.
Is there a more elegant way of querying for those articles?
Currently I'm first getting all of existing categories :
get_terms('category', array('hide_empty' => 0)
Than I'm using
foreach to loop through those categories and in each loop cycle I'm getting 4 articles from that category by using :
$articles = get_posts(array('numberposts' => 4, 'category' => $c->term_id));
And all of that is within my template file which I don't like.
Is this the recommended wordpress way, or is there more elegant solution?
I'm also bothered that by default, wordpress allready queries for most recent articles in advance on the homepage, so that query is kind of going to waste in my case.