I want to get the last 20 posts (in my case WooCommerce products) and show 10 of them in a random order.
For now I get the new posts like this:
$args = array(
'post_type' => 'product',
'orderby' => 'date',
'order' => 'DESC',
'posts_per_page' => 20,
);
I know that I could get the posts in random order like this:
'orderby' => 'rand',
'posts_per_page' => 10,
But how is it possible to combine these two? w Is there a way to store the posts from the first loop and use them in a second loop?
Aucun commentaire:
Enregistrer un commentaire