Exclude two specific categories from filter bar menu

Home Forums Calendar Products Filter Bar Exclude two specific categories from filter bar menu

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #1134113
    André Gualhanone
    Participant

    We are using two specific event categories only for internal control.

    How can we exclude that categories from appearing as options on filter bar dropdown menu?
    We don’t want exclude the events under this categories from event listing page.

    Also could we prevent that categories being printed on single event page info?

    Thanks.

    #1134692
    Nico
    Member

    Hi André,

    Thanks for getting in touch with us! I’ll help you here…

    How can we exclude that categories from appearing as options on filter bar dropdown menu?

    Paste the snippet below in your theme (or child theme) functions.php file and be sure to place your correct category names:

    /* Tribe hide categories from filter */
    function tribe_modify_category_filter ( $values, $slug ) {

    if ( $slug != 'eventcategory' ) return $values;

    foreach ( $values as $key => $value ) {

    if ( $value['name'] == 'Category Name' || $value['name'] == 'Category Name 2' ) {

    unset( $values[$key] );

    }
    }

    return $values;

    }
    add_filter( 'tribe_events_filter_values', 'tribe_modify_category_filter', 10, 2 );

    Also could we prevent that categories being printed on single event page info?

    I’ve took a look and I’m not sure there might be a snippet that helps 🙁 Probably the best solution is to override the single event template (check the themer’s guide for more details on this) and replace the tribe_get_event_categories function for another on in which you can exclude the cat IDs. Does this sounds good to you? Need extra help to get it done?

    Please let me know about it,
    Have a great weekend,
    Nico

    #1140756
    Support Droid
    Keymaster

    This topic has not been active for quite some time and will now be closed.

    If you still need assistance please simply open a new topic (linking to this one if necessary)
    and one of the team will be only too happy to help.

Viewing 3 posts - 1 through 3 (of 3 total)
  • The topic ‘Exclude two specific categories from filter bar menu’ is closed to new replies.