Last active
September 6, 2016 16:56
-
-
Save BeardedGinger/ea60931dd8dae7818465727f090e784f to your computer and use it in GitHub Desktop.
Filter event list query for The Events Calendar plugin to show events that start 30 days from now
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_filter( 'tribe_events_list_widget_query_args', 'jm_filter_list_widget_query_args' ); | |
/** | |
* Filter the query used for the Event List Widget to show only events starting | |
* in the future | |
*/ | |
function jm_filter_list_widget_query_args( $args ) { | |
$offset = 86400 * 30; | |
$date = date( 'U' ) + $offset; | |
$args['eventDisplay'] = 'list'; | |
$args['meta_query'] = array( | |
array( | |
'key' => '_EventStartDate', | |
'value' => date( 'Y-m-d H:i:s', $date ), | |
'compare' => '>=', | |
'type' => 'DATETIME', | |
), | |
); | |
return $args; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment