Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Modifies the Event Espresso calendar query to include events that have not ended yet when show_expired=false is set
<?php // remove if there's already an opening PHP tag in your funcitons.php file
add_filter ( 'filter_hook_espresso_calendar_sef_and_start_end_dates', 'my_custom_calendar_query_not_yet_ended' );
function my_custom_calendar_query_not_yet_ended() {
// this will filter the query so events that have closed for registration, but haven't ended yet,
// will display when show_expired is false
$today = date( 'Y-m-d' );
$sql = " AND e.end_date >= '$today' ";
return $sql;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.