Help Desk

Add Filter with existing taxonomy/category

  • Topics: 5
    | Permalink

    Hey there! I just got filter bar. My knowledge of PHP is pretty limited, but I’m a decent Googler. 🙂

    I am using CPT UI to add two custom taxonomies to a few existing post types. Those taxonomies are ‘campus’ to select which location the event is relevant to, and ‘department’ to select which department the event is relative to.

    I see the article on how to build a custom filter from scratch, but I cannot seem to find anything on adding an existing taxonomy to the filter bar.

    I found this article as well: https://theeventscalendar.com/support/forums/topic/generic-function-for-adding-custom-taxonomy-to-the-filter-bar/

    Can you tell me if I add that block of code and then add

    new Tribe__Events__Filterbar__Custom('Taxonomy Name','tax_slug');

    `new Tribe__Events__Filterbar__Custom(‘Taxonomy Name’,’tax_slug’);’

    to my functions.php file if that will solve my problem? Or is there something else I need to do?

    Posts: 6978 Topics: 2
    | Permalink

    Hi Andrew, thanks for reaching out to us!

    Personally I haven’t played with that snippet much, but according to the poster it should work.

    Based on what I read there you need to add that block of code to your functions.php file.

    Then at the end, before the ‘endif;’ add the ‘new Tribe__Events__Filterbar…’ line as many times as you need.

    Do not forget to change ‘tax_slug’ to the slugs your taxonomies use.

    And that should be it I believe.

    Let me know how that plays out.

    Cheers,
    Andras

     

    Posts: 65
    | Permalink

    Hey there! This thread has been pretty quiet for the last three weeks, so we’re going to go ahead and close it to avoid confusion with other topics. If you’re still looking for help with this, please do open a new thread, reference this one and we’d be more than happy to continue the conversation over there.

    Thanks so much!
    The Events Calendar Support Team

    | Permalink