Order/Sort by end-date in a WP_Query
-
Hi,
i can’t figure out how to sort events by end-date. I use new WP_Query().
I’ve tried the tribe_events_query_posts_orderby filter withadd_filter( 'tribe_events_query_posts_orderby', 'change_tribe_query_orderby' ); function change_tribe_query_orderby() { global $wpdb; return "tribe_event_end_date.meta_value ASC"; }which worked at the front end but gave me an SQL-Error at the back end.
I’ve also tried different query-vars like
'orderby'=>'EventEndDate', 'order' => 'ASC'or
'meta_key'=>'_EventEndDate', 'orderby' => 'meta_value', 'order' => 'ASC'the first one had no effect and the second one returned the events but the EventStartDate was equal to EventEndDate in the var_dump of the query.
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
The topic ‘Order/Sort by end-date in a WP_Query’ is closed to new replies.