How to show the posts of some category first, and then all other posts that does not belong to that category?
I have logic that get the category and reorder the posts. But i don’t know how to use. Please help.
$args = array(
'post_type' => 'event',
'meta_key' => '_event_end_date',
'meta_compare' => '>',
'meta_value' => $today,
'order' => 'DESC',
'posts_per_page' => '10'
);
$loop = new WP_Query( $args );
You can’t do it in one query. You have to add second query to show the posts of another category. Like
$args = array(
'post_type' => 'event',
'cat' => 4 //category id.
);
$posts = new WP_Query( $args ); // Get all the posts category which you want to show first.
$args2 = array(
'post_type' => 'event',
'cat' => -4 //Display all posts exclude this category.
);
$posts = new WP_Query( $args2 ); // Get all the posts category which you want to show second.
For reference check here: http://codex.wordpress.org/Class_Reference/WP_Query#Category_Parameters