jeudi 5 février 2015

Query posts distinct authors


I am trying to get post from a category ordered random, but making sure that the author does not repeat itself.


So I have this query which works as intended, but there is the chance that the author will repeat in those 4 posts. So any ideas how I could make sure it doesn't?


I was thinking of using $wpdb but I was hoping for a more straight forward solution.



$args = array (
'post_type' => 'post',
'post_status' => 'publish',
'category_name' => 'premium',
'orderby' => 'rand',
'posts_per_page' => 4,
'post__not_in' => get_option( 'sticky_posts' ),
'date_query' => array(
array(
array(
'before' => 'this week'
)
),
),
);
$query = new WP_Query( $args );




Aucun commentaire:

Enregistrer un commentaire