disorganized
Forum Replies Created
-
Okay, so it looks like event_start_time and event_end_time do exist. However my code doesn’t appear to be working as it’s showing events from yesterday, and events from today with future start/end times.
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’]==’now’ ){
$current_date = date(‘Y-m-d’,current_time(‘timestamp’));
$current_time = date(‘h:i a’,current_time(‘timestamp’));
$conditions[‘scope’] = ” (event_start_date = CAST(‘$current_date’ AS DATE) AND curtime() >= event_start_time OR curtime() <= event_end_time)”;
}
return $conditions;
}Okay, so I figured out from reading down toward the end of the docs that I should put this code in my theme’s functions.php file. So i’ve got that figured out.
Now, the only issue I see is in this line:
$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))";I’m guessing that
event_start_dateandevent_end_dateare.. fields in a table? functions? I need to combine something likeevent_start_dateandevent_start_time. But doesevent_start_timeexist? Or doesevent_start_dateinclude the starting time? If so, in what format? If not, how would I create something to return the events start time?Looks doable. But it doesn’t say anywhere which files the code should be added to.
I actually want to do somewhat the opposite. I only want to show an event which is currently on-going. If the current time is in between the event’s start and end time. Is this possible?