Filter Events List problem
-
Hi everyone,
I tried to use filter today-tomorrow but it doesn’t work even if I use it directly 🙁 …
I would like to start from that filter to implement a filter by a single date passed from datepicker, more complex…why this is not working? This should filter for today ( even is just implemented from authors, I would like to understand how to use the filter manually )add_filter( 'em_events_build_sql_conditions', 'my_em_scope_conditions',1,2); function my_em_scope_conditions($conditions, $args){ if( !empty($args['scope']) && $args['scope']=='my_custom_date' ){ $start_date = date('Y-m-d', current_time('timestamp')); $end_date = date('Y-m-d', current_time('timestamp')); $conditions['scope'] = " (event_start_date BETWEEN CAST('$start_date' AS DATE) AND CAST('$end_date' AS DATE)) OR (event_end_date BETWEEN CAST('$end_date' AS DATE) AND CAST('$start_date' AS DATE))"; } return $conditions; } add_filter( 'em_get_scopes','my_em_scopes',1,1); function my_em_scopes($scopes){ $my_scopes = array( 'my_custom_date' => 'My custom date' ); return $scopes + $my_scopes; }
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
The topic ‘Filter Events List problem’ is closed to new replies.