Exclude Category – The Events Calendar (not pro)

Home Forums Welcome! Pre-Sales Questions Exclude Category – The Events Calendar (not pro)

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #1115184
    Marc Simpson
    Guest

    Hi,

    I’m attempting to exclude a category from the main calendar page (all views). I’ve found several variations of the answer given here: https://theeventscalendar.com/support/forums/topic/exclude-one-category-from-upcoming-events-list/#post-46807

    I’ve added these to my child themes functions.php file and it has no effect.

    Here is my code:
    // from http://snippi.com/s/rd9pqcd
    add_action( ‘pre_get_posts’, ‘exclude_events_category’ );
    function exclude_events_category( $query ) {
    if ( $query->query_vars[‘post_type’] == TribeEvents::POSTTYPE && $query->query_vars[‘eventDisplay’] == ‘upcoming’ || $query->query_vars[‘eventDisplay’] == ‘past’ && !is_tax(TribeEvents::TAXONOMY) && empty( $query->query_vars[‘suppress_filters’] ) ) {
    $query->set( ‘tax_query’, array(
    array(
    ‘taxonomy’ => TribeEvents::TAXONOMY,
    ‘field’ => ‘slug’,
    ‘terms’ => array(‘replaced-with-slug-of-excluded-category’),
    ‘operator’ => ‘NOT IN’
    )
    )
    );
    }
    return $query;
    }

    I noticed these answers were from The Events Calendar PRO forum. Should this solution be working with the standard version?
    Is there a different solution for the standard version to exclude categories?

    Thanks in advance.

    #1115360
    Nico
    Member

    Hi Marc,

    Thanks for reaching out to us! Unfortunately we are not able to provide support in the pre-sales forum 🙁

    Give this snippet a try instead:

    https://gist.github.com/elimn/c47fb3e65d437c2479bd

    We are happy to assist our premium users with support issues via our premium forums, please log into the account that has been created when the purchase was made. If you have not purchased one of our premium plugins, you can post in our open source forum. We review that forum weekly, mainly for bug reports.

    I’ll go ahead and close out this thread, but please do post in the appropriate forum and we will assist you.

    Best,
    Nico

Viewing 2 posts - 1 through 2 (of 2 total)
  • The topic ‘Exclude Category – The Events Calendar (not pro)’ is closed to new replies.