Skip to content

Instantly share code, notes, and snippets.

@joshfeck
Created May 20, 2014 19:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save joshfeck/8cadf4daa54b9feef721 to your computer and use it in GitHub Desktop.
Save joshfeck/8cadf4daa54b9feef721 to your computer and use it in GitHub Desktop.
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