Order posts by more than one variable (meta_key and publish date AND time)
At cascadeoc.org/results I have results sorted by a Custom Field, "event_date_results" which is the date the event happened (not the date the post was published). However, when there are multiple results from the same day, I'd like to further control post order by published date and TIME. How can I add this second orderby filter?
Here's what I have:
?php
$query = new WP_Query( array(
'post_type' = 'result',
'posts_per_page' = 100,
//'paged' = $paged,
'meta_key' = 'event_date_results',
'orderby' = 'meta_value_num',
'order' = 'DESC',
'meta_value' = date('Ymd'),
'meta_compare' = '',
'date_query' = array(
array(
'key' = 'date',
'value' = date('Ymd'),
'compare' = '', //less than
'type' = 'DATETIME'
)
),
) );
?
Topic meta-value order wp-query Wordpress
Category Web