Skip to content

Instantly share code, notes, and snippets.

@andrasguseo
Created September 29, 2016 09:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save andrasguseo/60a26cd98acd4d6b077d25207f19e734 to your computer and use it in GitHub Desktop.
Save andrasguseo/60a26cd98acd4d6b077d25207f19e734 to your computer and use it in GitHub Desktop.
For jussibr - The Events Calendar Remove Events from Month and List Views
/*
* The Events Calendar Remove Events from Month and List Views
* add coding to theme's functions.php
* @version 3.12
* 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' ) && ! tribe_is_community_my_events_page() ) {
if ( $query->query_vars['eventDisplay'] == 'list' && ! is_tax( Tribe__Events__Main::TAXONOMY ) || $query->query_vars['eventDisplay'] == 'month' && $query->query_vars['post_type'] == Tribe__Events__Main::POSTTYPE && ! is_tax( Tribe__Events__Main::TAXONOMY ) && empty( $query->query_vars['suppress_filters'] ) ) {
$query->set( 'tax_query', array(
array(
'taxonomy' => Tribe__Events__Main::TAXONOMY,
'field' => 'slug',
'terms' => array( 'kids-camp-programs', 'kids-programs-and-workshops' ),
'operator' => 'NOT IN'
)
) );
}
}
return $query;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment