Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function pnh_filter_tribe_all_occurences ( $query ) {
- //If we're in the admin, make no query alterations
- if ( is_admin() )
- return $query;
- // Get the event category slug
- $eventcat = (isset( $query->query_vars[Tribe__Events__Main::TAXONOMY] ) && $query->query_vars[Tribe__Events__Main::TAXONOMY] != '' ? $query->query_vars[Tribe__Events__Main::TAXONOMY] : '');
- //Check that the event category being called isn't one of the 3 we're excluding
- //(if it is, then don't do the exclusion)
- if ( $eventcat != 'music-club-listings' && $eventcat != 'art-exhibits-events' && $eventcat != 'theater' ) {
- //Add a tax query to exclude the Art, Club Listings, and Theater categories by all views (except those specific categories)
- $taxquery = array(
- array(
- 'taxonomy' => Tribe__Events__Main::TAXONOMY,
- 'field' => 'id',
- 'terms' => array(21,22,17), //Art = 21, Club Listings = 22, Theater = 17
- 'operator' => 'NOT IN'
- )
- );
- $query->query_vars['tax_query'][] = $taxquery;
- }
- return $query;
- }
- add_action('tribe_events_pre_get_posts', 'pnh_filter_tribe_all_occurences',1000);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement