Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Removes categories "meetup" and shindig" from month and list views ?>
- add_action( 'pre_get_posts', 'exclude_events_category' );
- function exclude_events_category( $query ) {
- if ( $query->query_vars['eventDisplay'] == 'upcoming' && !is_tax(TribeEvents::TAXONOMY) || $query->query_vars['eventDisplay'] == 'month' && $query->query_vars['post_type'] == TribeEvents::POSTTYPE && !is_tax(TribeEvents::TAXONOMY) && empty( $query->query_vars['suppress_filters'] ) ) {
- if ( current_user_can( 'edit_post' ) ) {
- return $query;
- } else {
- $query->set( 'tax_query', array(
- array(
- 'taxonomy' => TribeEvents::TAXONOMY,
- 'field' => 'slug',
- 'terms' => array( 'meetup', 'shindig' ),
- 'operator' => 'NOT IN'
- )
- ));
- }
- }
- return $query;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement