Created
September 15, 2012 11:13
-
-
Save codearachnid/3727382 to your computer and use it in GitHub Desktop.
Tri.be event calendar pre_get_posts fix
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 | |
/** | |
* | |
* In cases where pre_get_posts changes the 'post_type' query var to post (or another post type) | |
* if the original query 'post_type' is 'tribe_events' then reset so that the calendar list views | |
* continue to work properly. | |
* | |
*/ | |
add_filter('pre_get_posts', 'tribe_fix_pre_get_posts_reset'); | |
function tribe_fix_pre_get_posts_reset($query){ | |
if( isset($query->query['post_type']) && $query->query['post_type'] == TribeEvents::POSTTYPE) { | |
$query->set('post_type',TribeEvents::POSTTYPE); | |
} | |
return $query; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment