[Plugin: Events Manager] Showing only future events and those that ended at most X hours ago
-
The default scope ‘future’ shows all events that start or end today or later. This creates a situation where when looking at the event list in the evening, the first thing a person sees are events that ended right after the midnight, some 20 hours ago.
I’d like to create a custom scope that acts otherwise the same, but doesn’t display events that have ended more than X hours ago. With the instructions for creating a custom scope I have solved hopefully every other part of the issue except of the correct way to reference the ending time of the event in hours, as the example code handles only full days:
$start_date = date('Y-m-d',current_time('timestamp')); $end_date = date('Y-m-d',strtotime("+1 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))";
- The topic ‘[Plugin: Events Manager] Showing only future events and those that ended at most X hours ago’ is closed to new replies.