Problem: I am using Event Calendar Pro to create and manage events. I would like to create a View of all current and upcoming events, but the Query Filter doesn't seem to be working as expected.
Solution: Use custom code to adjust the Query Filter to respond to the date format used by Event Calendar Pro.
function tssupp_filter_event_query( $view_args, $view_settings, $view_id ){ if ( in_array( $view_id, array( 12345 ) ) ) { // Edit view IDs if ( ! isset( $view_args['meta_query'] ) ) { $view_args['meta_query'] = array(); } $meta_query = array( 'key' => '_EventEndDate', 'value' => date("Y-m-d H:i:s"), 'type' => 'NUMBER', 'compare' => '>' ); $view_args['meta_query'][] = $meta_query; } return $view_args; } add_filter( 'wpv_filter_query', 'tssupp_filter_event_query', 101, 3 );
Relevant Documentation:
https://toolset.com/documentation/programmer-reference/views-filters/#wpv_filter_query
This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.
Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.
Sun | Mon | Tue | Wed | Thu | Fri | Sat |
---|---|---|---|---|---|---|
8:00 – 12:00 | 8:00 – 12:00 | 8:00 – 12:00 | 8:00 – 12:00 | 8:00 – 12:00 | - | - |
13:00 – 17:00 | 13:00 – 17:00 | 13:00 – 17:00 | 13:00 – 17:00 | 13:00 – 17:00 | - | - |
Supporter timezone: America/New_York (GMT-04:00)
This topic contains 3 replies, has 2 voices.
Last updated by 6 years ago.
Assisted by: Christian Cox.