Exclude Category

Home Forums Calendar Products Events Calendar PRO Exclude Category

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #796842
    Philip Murray
    Participant

    hi Barry,

    Following on from this thread – https://tri.be/support/forums/topic/exclude-specific-category/#post-724625

    the issue i have is i want to EXCLUDE a specific category from displaying in the MONTH VIEW

    is you look at this client site http://www.beaverstown.com/events/
    i want all those categories to be visible but not the RESULTS category

    I know I can show the RESULTS in a calendar of it’s own by pointing directly to it but how do i EXCLUDE it from this main calendar view?

    thanks

    Phil

    #797020
    Geoff
    Member

    Hi there, Phil!

    Great question. Try using this snippet in yourย functions.php file to exclude events in the “Results” category from displaying in the Month View:

    add_action( 'pre_get_posts', 'exclude_events_category' );
    function exclude_events_category( $query ) {
    if ( $query->query_vars['eventDisplay'] == 'upcoming' && !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('results'),
    'operator' => 'NOT IN'
    )
    
    )
    );
    }
    return $query;
    }

    If you’re looking to remove the Category label from the top of the calendar, you can do that in the CSS:

    li.tribe-events-category-14 {
    display: none;
    }

    Does this help answer your question? Please let me know. ๐Ÿ™‚

    Cheers!
    Geoff

    #797189
    Philip Murray
    Participant

    Brilliant Geoff – thanks – i will try it and let you know
    Phil

    #798666
    Geoff
    Member

    Awesome! Keep me posted. ๐Ÿ™‚

    #815963
    Geoff
    Member

    Hey there Phil, just checking in to see if thereโ€™s been any further update or if you still need assistance on this one–let me know. ๐Ÿ™‚

    Cheers!
    Geoff

    #841068
    Geoff
    Member

    Hey there, Phil! It’s been a while so I’m going to go ahead and close this thread. If we can help with anything else, though, please don’t hesitate to create new a new thread and we’d be happy to help. ๐Ÿ™‚

    Cheers!
    Geoff

Viewing 6 posts - 1 through 6 (of 6 total)
  • The topic ‘Exclude Category’ is closed to new replies.