Open studioleland opened 9 years ago
Any response on this?
It should theorically work out of the box with any custom post type but since from what I understand Events manager doesn't put the date in the post_date column you would have to implement your own pre_get_post
method and do a meta_query accordingly.
After some digging it looks like the meta_query should work to modify your query_args function. Everything else is in place I believe. Thanks.
Did you implement it?
Trying this tonight.
I did get this working! It's quite amazing:
Had to rework some of the js to remove the maxDate and modify the default date filter ranges from "Past" to "Next".
$wp_query->set( 'meta_query', array( 'relation'=>'AND', array( 'key' => '_event_start_date', //custom field start date YYYY-MM-DD 'value' => $lowerlimit, //lower limit YYYY-MM-DD 'compare' => '>=', 'type' => 'DATE' ), array( 'key' => '_event_end_date', //custom field end date YYYY-MM-DD 'value' => $upperlimit, //upper limits YYYY-MM-DD 'compare' => '<=', 'type' => 'DATE' ) ) );
What do I need to do to restrict this filter displaying for a single post type?
Hey dev,
Want to use this for the ever-popular WP Events Manager plugin to filter events by date. I just need to know how to structure your filter below to do this:
function my_date_range_filter_query_column( $column ){ return 'post_modified'; } add_filter( 'date_range_filter_query_column', 'my_date_range_filter_query_column', 10, 1 );
Post type of "event" and custom field of "_event_start_date"