Query different number of posts with different formats in one go

I want to output 7 latest status posts and 5 latest aside posts in one go (they should be sorted in one list from latest to earliest). But I don’t understand how to write such a WP_Tax_Query. I’ve tried the following and it didn’t work as intended:

$args = array(
‘relation’ => ‘AND’,
array(
‘post_format’ => ‘post-format-status’,
‘posts_per_page’ => 7,
),
array(
‘post_format’ => ‘post-format-aside’,
‘posts_per_page’ => 5,
)
);
$q = new WP_Query($args);
if ( $q->have_posts() ) {
while ( $q->have_posts() ) { $q->the_post(); the_title(); }
wp_reset_postdata();}

Read more here:: Query different number of posts with different formats in one go

Leave a Reply

Your email address will not be published. Required fields are marked *