Hi I have tried this for active events, featured is coming first ok but the date orderby is not working (after featured events latest posted events coming next)
// find date time now $date_now = date('Y-m-d H:i:s'); // query events $posts = get_posts(array( 'posts_per_page' => -1, 'post_type' => 'event', 'meta_query' => array( 'date_clause' => array( 'relation' => 'AND', array( 'key' => 'start_date', 'compare' => '<=', 'value' => $date_now, 'type' => 'DATETIME' ), array( 'key' => 'end_date', 'compare' => '>=', 'value' => $date_now, 'type' => 'DATETIME' ) ), 'feature_clause' => array( 'key' => 'featured', 'compare' => 'EXISTS' ) ), 'orderby' => array( 'feature_clause' => 'DESC', 'date_clause' => 'ASC' ) ));
Please help on this (I want to show featured events first next active events based on end date first)
Please help on this
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
© 2022 Advanced Custom Fields.