grayham
Forum Replies Created
Viewing 2 replies - 1 through 2 (of 2 total)
-
Hi Angelo,
Sorry for my delay in reply. I managed to get this working with your instructions. Thank you!
For reference; the code I used was…
<?php 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-year' ){ $start_date = date('Y-m-d',strtotime("First day of January", 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( 'this-year' => 'Events this year' ); return $scopes + $my_scopes; } ?>Hi Angelo,
Sorry I am afraid that does not work for the purpose I am looking for.
The code above gives me a paginated list of future events.
I am looking for a list of past events within a given category within 2015.
Viewing 2 replies - 1 through 2 (of 2 total)