7 day scope not working
-
Hi
I’m trying to create a scope to show events for the next 7 days, however it’s displaying events from 2013 and for more than 7 days.
Function code:
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']=='this-week' ){ $start_date = date('Y-m-d',current_time('timestamp')); $end_date = date('Y-m-d',strtotime("+6 day", 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( 'this-week' => 'This Week' ); array_splice($scopes, 5, 0, $my_scopes); return $scopes; }
Page code:
[events_list scope="This Week"]<tr> <td> <br/> <div style="float:left; width: 70%;"> <h3><strong>#_EVENTLINK</strong></h3> #_EVENTDATES - #_EVENTTIMES | #_ATT{Cost} {has_location}<br/><i>#_LOCATIONNAME, #_LOCATIONADDRESS, #_LOCATIONTOWN, #_LOCATIONPOSTCODE</i>{/has_location} <p>#_EVENTEXCERPT</div></p> <div style="float:right; margin: 0px 0px 10px 15px;" width:25%;">#_EVENTIMAGE{100,100}</div> <br style="clear:both" /> <div style="border-bottom: 1px dotted #e5e5e5;"></div> </td> </tr>[/events_list]
Page link:
https://www.black-gold.biz/whats-on-next-7-days/If your able to provide any help and/or advice it would be greatly appreciated.
Thanks Val ??
Viewing 5 replies - 1 through 5 (of 5 total)
Viewing 5 replies - 1 through 5 (of 5 total)
- The topic ‘7 day scope not working’ is closed to new replies.