Order by the first array within a meta_query
I would like to sort the output of my WP Query. I want the events that are coming up soon to be at the beginning. The events that have already taken place should be at the end. So the first array in my meta_query should be output first, then the second array.
$the_query = new WP_Query(
array(
'post_type' = 'page',
'post_status' = 'publish',
'posts_per_page' = $posts,
'meta_key' = 'datum-von',
'orderby' = 'meta_value upcoming_events',
'order' = 'ASC',
'post__in' = array(22888,23062,23065,23348),
'meta_query' = array(
'relation' = 'OR',
'upcoming_events' = array(
'key' = 'datum-von',
'value' = date('Y-m-d'),
'compare' = '=',
'type' = 'DATE'
),
'past_events' = array(
'key' = 'datum-von',
'value' = date('Y-m-d'),
'compare' = '=',
'type' = 'DATE'
)
),
)
);
Does anyone have an idea how I can control the sorting? Thanks for reading!
Topic meta-query wp-query custom-field Wordpress
Category Web