I am trying to orderby my CPT if the current time is in between two meta fields. (i.e, the
current_time() is between two time fields.).
meta_query returns only the posts that are between the values, but not all posts. Here is what I have tried.
$args['meta_query'] = array( array( 'key' => 'open_today', 'value' => strtolower(current_time('l')), ), array( 'key' => 'open_time', 'value' => current_time(), 'compare' => '>=' ), array( 'key' => 'close_time', 'value' => current_time(), 'compare' => '<' ), );
Basically what I am trying to achieve is that sort restaurants by open time. So, when a user selects to sort the listing by Open Now, the query returns the resturants open now at first and then rest of them.