Home › Forums › Backend Issues (wp-admin) › Query Date Picker by Date then Time › Reply To: Query Date Picker by Date then Time
Hi @svsdnb,
No – I hadn’t done, but you could effectively just add that to the code to replace the meta query that checks that time EXISTS with something more akin to the date check.
$todays_date = current_time('Ymd');
$right_now = current_time('Hi');
$args = array(
'post_type' => 'events',
'posts_per_page' => '-1',
'meta_query' => array(
'relation' => 'AND',
'date_clause' => array(
'key' => 'event_date',
'compare' => '>=',
'value' => $todays_date,
),
'time_clause' => array(
'key' => 'event_time',
'compare' => '>=',
'value' => $right_now,
),
),
'orderby' => array(
'date_clause' => 'ASC',
'time_clause' => 'ASC',
)
);
I have yet to look at the Time picker field as part of the latest version, but something akin to that should work fine.
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!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.