Forked from jesseeproductions/remove-categories-not-replated.php
Last active
December 23, 2015 20:29
-
-
Save niconerd-zz/47428c8b994422d6f549 to your computer and use it in GitHub Desktop.
Removes categories "tech" from list, day and month views
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
/* | |
* The Events Calendar Remove Events from Month and List Views | |
* add coding to theme's functions.php | |
* @version 4.0 | |
* modify here with event category slugs: array( 'concert', 'convention' ) | |
*/ | |
add_action( 'pre_get_posts', 'tribe_exclude_events_category_month_list' ); | |
function tribe_exclude_events_category_month_list( $query ) { | |
if ( isset( $query->query_vars['eventDisplay'] ) && ! is_singular( 'tribe_events' ) && ! $query->tribe_is_event_category ) { | |
if ( ( $query->query_vars['eventDisplay'] == 'list' || $query->query_vars['eventDisplay'] == 'month' || $query->query_vars['eventDisplay'] == 'day' ) && $query->query_vars['post_type'] == Tribe__Events__Main::POSTTYPE && empty( $query->query_vars['suppress_filters'] ) ) { | |
$query->set( 'tax_query', array( | |
array( | |
'taxonomy' => Tribe__Events__Main::TAXONOMY, | |
'field' => 'slug', | |
'terms' => array( 'concert', 'convention' ), | |
'operator' => 'NOT IN' | |
) | |
) ); | |
} | |
} | |
return $query; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment