Advertisement
BakerMan

Modifying Events (Exclude Categories) (TEC)

Sep 3rd, 2012
237
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.61 KB | None | 0 0
  1. function exclude_events_category( $query ) {
  2.  
  3.     if ( $query->query_vars['eventDisplay'] == 'upcoming' || $query->query_vars['eventDisplay'] == 'past' || $query->query_vars['eventDisplay'] == 'month' && $query->query_vars['post_type'] == TribeEvents::POSTTYPE && !is_tax(TribeEvents::TAXONOMY) && empty( $query->query_vars['suppress_filters'] ) ) {
  4.         $query->set( 'tax_query', array(
  5.             array(
  6.                 'taxonomy' => TribeEvents::TAXONOMY,
  7.                 'field' => 'slug',
  8.                 'terms' => array('2012'),
  9.                 'operator' => 'NOT IN'
  10.                 )
  11.             )
  12.         );
  13.     }
  14.  
  15.     return $query;
  16. }
  17.  
  18. add_action( 'pre_get_posts', 'exclude_events_category' );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement