Hello.
I am trying to exclude a single category from our upcoming/month view pages. Here is the code I have in my theme’s functions.php file, as per other forum topics:
add_action( 'pre_get_posts', 'exclude_events_category' );
function exclude_events_category( $query ) {
if ( $query->query_vars['eventDisplay'] == 'upcoming' || $query->query_vars['eventDisplay'] == 'past' || $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('yard-sales'),
'operator' => 'NOT IN'
)
) );
}
return $query;
}
However, this also removes ‘yard-sales’ category events from the front-end user’s “My Events” page. Since we are only using the Community Events add-on to allow people to post yard sales, which we’re trying to display separately from our main events calendar, this is an issue.
Is it possible to exclude the category from the main upcoming events page AND display it on the front-end user’s “My Events” page?
Thanks for your help.