Order by Start Date
-
Hello,
I am attempting to create a custom query to order the event posts by event start date as compared to the current date. The goal is to to display the events in ascending order that are greater than are equal to the current date.Do you know a way of doing this?
Currently my method isn’t working. Not sure this is possible with the below code since the date field is outputted as a string?
Thanks for your assistance.
Here’s my Code:
`$args = array (
‘post_type’ => ‘facebook_events’,
‘posts_per_page’ => 6,
‘meta_query’ => array(
‘key’ => ‘event_starts’,
‘value’ => date(‘Ymd’),
‘compare’ => ‘>=’
),
‘orderby’ => ‘meta_value’,
‘order’ => ‘ASC’);
The topic ‘Order by Start Date’ is closed to new replies.