Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- Usage: [events_list scope="today-future"]
- */
- add_filter( 'em_get_scopes','my_em_today_scopes',1,1);
- function my_em_today_scopes($scopes){
- $my_scopes = array(
- 'today-future' => 'Today and Future'
- );
- return $scopes + $my_scopes;
- }
- add_filter( 'em_events_build_sql_conditions', 'my_em_today_scope_conditions',100,2);
- function my_em_today_scope_conditions($conditions, $args){
- if( !empty($args['scope']) && $args['scope']=='today-future' ){
- $date_today = date('Y-m-d',current_time('timestamp'));
- $conditions['scope'] = " (event_start_date >= CAST('".$date_today."' AS DATE) OR event_end_date >= CAST('".$date_today."' AS DATE))";
- }
- return $conditions;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement