Skip to content

Instantly share code, notes, and snippets.

@joshfeck
Created August 22, 2018 18:19
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/a4bf882c0feb79459d15b2f9294b84f4 to your computer and use it in GitHub Desktop.
Save joshfeck/a4bf882c0feb79459d15b2f9294b84f4 to your computer and use it in GitHub Desktop.
Filter the Event Espresso upcoming events widget so it only includes events where their first datetime has not started yet.
<?php
//* Please do NOT include the opening php tag, except of course if you're starting with a blank file
add_filter( 'FHEE__EEW_Upcoming_Events__widget__where', 'my_custom_events_widget_where_params', 10, 3 );
function my_custom_events_widget_where_params( $where, $category, $show_expired ) {
if ( ! $show_expired ) {
$where['Datetime.DTT_EVT_start'] = array( '>=', EEM_Datetime::instance()->current_time_for_query( 'DTT_EVT_start' ) );
$where['Datetime.DTT_order'] = 1;
}
return $where;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment