Last active
January 22, 2016 19:49
-
-
Save GeoffEW/ef2da29e76f585f1ef8d to your computer and use it in GitHub Desktop.
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
// Only Display Events with Starting Date from today on // | |
function start_date_strict($query) { | |
$post_type = $query->query_vars['post_type']; | |
// if ($post_type == 'tribe_events') { **ORIGINAL** | |
if ($post_type == 'tribe_events' && (tribe_is_list_view() || tribe_is_photo() ) ) { | |
$filterDate = current_time('Y-m-d H:i:s'); | |
if (!empty( $_REQUEST['tribe-bar-date'] ) ) { | |
$filterDate = $_REQUEST['tribe-bar-date']; | |
} | |
$query->query_vars['meta_query'][] = | |
array( // restrict posts based on meta values | |
'key' => '_EventStartDate', // which meta to query | |
'value' => $filterDate, // value for comparison | |
'compare' => '>=', // method of comparison | |
'type' => 'DATETIME'); | |
} | |
} | |
add_filter( 'tribe_events_pre_get_posts', 'start_date_strict', 100, 1 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment