I scoured the forum looking for some code to do this. I found the following but now it is throwing an error but I don’t understand the error:
The error:
Notice: Undefined index: eventDisplay in /nas/content/staging/newleaderdog/wp-content/themes/leaderdog_child/functions.php on line 181
The code:
/ Removes categories “puppy raisers” from list and month views
add_action( ‘pre_get_posts’, ‘exclude_events_category’ );
function exclude_events_category( $query ) {
if ( ! is_singular( ‘tribe_events’) && ! is_page(3434) && $query->query_vars[‘eventDisplay’] == ‘list’ && !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’] ) ) {
$query->set( ‘tax_query’, array(
array(
‘taxonomy’ => TribeEvents::TAXONOMY,
‘field’ => ‘slug’,
‘terms’ => array(‘puppy-raisers’),
‘operator’ => ‘NOT IN’
)
)
);
}
return $query;
}
Thanks.
Melanie