Custom scope not working
-
I have been using this code for some time to remove events after one hour from the widget. It hast somehow stopped working and events will not simply show until the next day.
// Future and X hours ago aka 'mycustomfuture' add_filter( 'em_events_build_sql_conditions', 'my_em_scope_mycustomfuture_conditions',1,2); function my_em_scope_mycustomfuture_conditions($conditions, $args){ $grace_period = '1 hour'; // How long to show events after ending if( !empty($args['scope']) && $args['scope']=='mycustomfuture' ){ $start_date = date('Y-m-d',current_time('timestamp')); $today = $start_date; if ( date( 'd', strtotime( 'now' ) ) != date( 'd', strtotime( '-' . $grace_period, 'now' ) ) ) { $end_time = '00:00:00'; } else { $end_time = date( 'H:i:s', strtotime( '-' . $grace_period, current_time('timestamp') ) ); } $conditions['scope'] = " (recurrence = 0 OR recurrence IS NULL) AND ( event_start_date > CAST('$today' AS DATE) OR event_end_date > CAST('$today' AS DATE) OR ( event_end_date = CAST('$today' AS DATE) AND ( event_all_day = '1' OR event_end_time >= CAST('$end_time' AS TIME) ) ) ) "; } return $conditions; }
Does anyone know if the code stopped working or if there is another way to achieve this?
Viewing 5 replies - 1 through 5 (of 5 total)
Viewing 5 replies - 1 through 5 (of 5 total)
- The topic ‘Custom scope not working’ is closed to new replies.