I am using the following custom query, and Bricks ignores the time sort for some reason. The same query was used to modify the WP API results, and it works perfectly. I am not sure if this is a bug or if I am missing something obvious.
$today = date(‘Y-m-d’);
return [
‘post_type’ => ‘events’,
‘meta_query’ => array(
array(
‘key’ => ‘e_start_date’,
‘value’ => $today,
‘compare’ => ‘>=’,
‘type’ => ‘DATE’,
),
),
‘orderby’ => array(
‘e_start_date’ => ‘ASC’, //yyy-mm-dd
‘e_start_time’ => ‘ASC’, //hh:mm (24 hour)
‘title’ => ‘ASC’,
),
‘posts_per_page’ => 24,
];
try this and tell me if it works or not
its hard to know the solution without knowing your content setup…
return [
'post_type' => 'events',
'posts_per_page' => 24,
'meta_query' => [
'relation' => 'AND',
'start_date_clause' => [
'key' => 'e_start_date',
'value' => date('Y-m-d'),
'compare' => '>=',
'type' => 'DATE',
],
'start_time_clause' => [
'key' => 'e_start_time',
'compare' => 'EXISTS',
'type' => 'TIME',
],
],
'orderby' => [
'start_date_clause' => 'ASC',
'start_time_clause' => 'ASC',
'title' => 'ASC',
],
];
1 Like
I could have sworn I tried this without success, but this did the trick. Thank you !!!
1 Like
I am not sure if it was a cacheing issue or what, but I cleared the cache (or so I thought) and no change. Then went back 5 minutes later and now it works. Thank you again.