Exclude one category from Event List View

Home Forums Calendar Products Events Calendar PRO Exclude one category from Event List View

Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • #24088
    Beth Avey
    Participant

    I would like to be able to exclude one category from the Event List View.
    The site — http://hardinchamber.com/events/

    I would like to take one Category of events for our organization and highlight them in a separate page. In doing this, I’d also like to eliminate them from showing up in the main feed.

    Thanks for any help you can offer!
    Wayne

    #24100
    Joyce Grace
    Member

    Hi Wayne,
    I think the easiest way to do this would be to just link to the categories directly using WordPress menus or whatever way you’re directing users to those pages.

    That being said, if you’d rather do some on-hand coding, here are tutorials that may help you:

    https://theeventscalendar.com/list-categories-above-calendar-view-for-quick-frontend-filtering/

    Actually, there are tons of tutorials that may help you here: https://theeventscalendar.com/the-events-calendar-for-wordpress-tutorials/

    Let me know if you find something that works!

    We also have technical documentation here: https://theeventscalendar.com/support/documentation

    #24142
    Beth Avey
    Participant

    Thank you, Joyce – the tutorial links are great and will give me good direction on linking to the distinct category “feed.” However, I’m still not seeing how to exclude a category from the main events feed (Events List View). Any help on this …?Thanks!

    #24171
    Joyce Grace
    Member

    Hi Wayne, unfortunately you’ll need to do some code hacking to customize this. We don’t really support customizations here on this forum 🙁 I was hoping the documentation pages would be able to give you something.

    That being said, let me see if one of the higher level support reps can provide a quick fix for this – no guarantees though.

    #24190
    Marc
    Participant

    I need the exact same thing. Would be happy to customize the appropriate php file or create a CSS hack, but just need some guidance.

    #24227
    Beth Avey
    Participant

    Thanks Joyce – I appreciate your responsiveness! Will await any further direction …

    Best wishes,
    Wayne

    #24269
    Barry
    Member

    Hi Wayne! it might be worth taking a look at this thread:

    https://theeventscalendar.com/support/forums/topic/make-a-specific-calendarcatagory-private/

    And Daniel’s solution in particular (towards the end of that thread). I hope that helps!

    #24275
    Beth Avey
    Participant

    Many thanks, Barry! I’ll try it and add any further comment there in that thread.

    Peace
    Wayne

    #24276
    Barry
    Member

    No problem, I hope that gets you on track 🙂

    #24295
    Jonah
    Participant

    Hi Wayne/Marc,

    You’ll want to use pre_get_posts for this. Here’s a snippet that should do what you need, just modify the category slug to your category:

    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'] == 'past' && !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('2012'),
    'operator' => 'NOT IN'
    )
    )
    );
    }

    return $query;

    }

    I hope that helps but let me know if you need anything else.

    – Jonah

Viewing 10 posts - 1 through 10 (of 10 total)
  • The topic ‘Exclude one category from Event List View’ is closed to new replies.