“eventful=1” not being obeyed with custom scope
-
Hi There
I am finding that when I use my custom scope in a locations map, the eventful search attribute is getting ignored.
If I use an out of the box scope, such as ‘month’ only eventful locations are showing on the map, perfect. For example: location_map scope=”month” eventful=”1″
However if I use ‘nextfortnight’ then all locations are being shown, even those with no events or events that do not match the scope. The scope itself seems to be correct, when clicking locations you only see events in the next 2 weeks
If put an example page here:
https://www.carshow.life/a-map-scope-test-2/Any help would be really appreciated!
The code I have added to my functions.php file is this:
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']=='nextfortnight' ){ $start_date = date('Y-m-d',current_time('timestamp')); $end_date = date('Y-m-d',strtotime("+14 days", 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( 'nextfortnight' => 'Next Fortnight' ); return $scopes + $my_scopes; }
- The topic ‘“eventful=1” not being obeyed with custom scope’ is closed to new replies.