New Query Feature?
-
I like the concept of adding a filter using the New Query ID. I use this with Elementor Post widget all the time to set the Category and the Start and End date so the Posts will auto show. I tried adding the same code to Prime Slider but nothing is being filtered. It shows all posts and doesn’t even filter the Category. The code below should filter based on the Category bing Cat1 and it also checks that the current date is between the start and End date fields, they are ACF fields. Any suggestions are appreciated.
add_action('elementor/query/test33', function($query){ $query->set('category_name', 'cat1'); $query->set('orderby', 'title'); $query->set('order', 'ASC'); $meta_query[] = [ [ 'key' => 'start_date', 'value' => date('Y.m.d'), //date format set in ACF 'compare' => '<=', 'type' => 'DATE' ], [ 'key' => 'end_date', 'value' => date('Y.m.d'), //date format set in ACF 'compare' => '>=', 'type' => 'DATE' ], ]; $query->set( 'meta_query', $meta_query ); });
Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
- The topic ‘New Query Feature?’ is closed to new replies.