dimitrilongo

exclude category event-calendar

Sep 9th, 2013
191
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.68 KB | None | 0 0
  1. add_action( 'pre_get_posts', 'exclude_events_category' );
  2. function exclude_events_category( $query ) {
  3.  
  4. 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'] ) ) {
  5. $query->set( 'tax_query', array(
  6. array(
  7. 'taxonomy' => TribeEvents::TAXONOMY,
  8. 'field' => 'slug',
  9. 'terms' => array('atelier-decritures','concours-litteraires'),
  10. 'operator' => 'NOT IN'
  11. )
  12. ) );
  13. }
  14.  
  15. return $query;
  16.  
  17.  
  18. }
Advertisement
Add Comment
Please, Sign In to add comment