Adding Custom Taxonomy to Filter Bar

Home Forums Calendar Products Filter Bar Adding Custom Taxonomy to Filter Bar

Viewing 15 posts - 1 through 15 (of 16 total)
  • Author
    Posts
  • #1348515
    Todd
    Participant

    Hi, I have had a relatively easy time customizing templates to get the data I want thanks to your great knowledgebase, forum and docs (styling of site will come soon!).
    One area that I am not finding success is in getting custom taxonomies onto the search filter bar. I understand that you don’t provide that kind of support, but my question is have you come across code from anyone that has successfully achieved this, as I can’t find it on my own.
    The best one I can find is Frederick’s work. But I’ve been unable to implement it. If this looks like the best solution to you as well, would you be able to provide some general direction towards its implementation?
    Thank you!

    #1348881
    Cliff
    Member

    Hi, Todd.

    Please reference https://theeventscalendar.com/knowledgebase/creating-custom-filters-for-filter-bar/ and if that’s not helpful enough, please see /wp-content/plugins/the-events-calendar-filterbar/src/Tribe/Filters/Category.php for an example of how our custom taxonomy gets added.

    Please let me know how this goes for you.

    #1348978
    Todd
    Participant

    Thanks for your direction, I found my problem – I was saving new filter in the /wp-content/plugins/the-events-calendar-filterbar/src/Tribe/Filters/ folder but it needs to be saved in functions or as plugin. It does work perfectly in functions.php, but does not as a plug-in. Do you know why this might be?

    #1349227
    Cliff
    Member

    Glad you got that sorted out.

    If it’s in a plugin, it should work just fine but make sure you go to /wp-admin/plugins.php and click to Activate it.

    If the plugin is activated and it’s the exact same code as what works via your active theme’s functions.php, but it’s still not working, please send me the full plugin .zip so I can try it out.

    #1353188
    Todd
    Participant

    Thanks Cliff, been trying to figure out on my own but can’t… I’ve attached the plugin, which is still not working at all as a plug-in for me (dumb error on my part?), and now only half-works in functions.php. The taxonomy filters (from venue) show up but when selected return no results. Thanks for taking a look.

    #1353756
    Cliff
    Member

    Todd, I can look into this a bit further, but at first glance I see you already have the PRO add-on as well. Why not just use a PRO Additional Field for your Neighborhoods filtering? It will automatically appear in Filter Bar.

    #1353757
    Todd
    Participant

    Thanks for the reply. I chose custom taxonomy because I need hierarchical terms. Is there a way to do that in filter bar? For example USA => FLORIDA => MIAMI, where user can search for just USA, Florida or Miami?

    #1355249
    Cliff
    Member

    Hi, Todd. Sorry for the delay getting back to you on this.

    The reason it does not work as a plugin is because it extends a class that does not yet exist. You would need to only load the plugin’s code at a later point. Therefore, it’s easier to just keep in your functions.php file, which runs after all the active plugins are loaded.

    As for your custom taxonomy, I wouldn’t be able to assist there because I can’t test any code I’d come up with to see if it works, since I don’t have that custom taxonomy on my site.

    Did you know Filter Bar has built-in filtering by country, state/province, and city? Just make sure your events are assigned to venues that have location data! Also, go to wp-admin > Events > Settings > Filters and make sure you have the desired filters active.

    Please let me know how this goes for you.

    #1358703
    Todd
    Participant

    Thanks Cliff for the additional information, I’ll keep it in functions.php then (a bit cleaner to have in plugin, but no problem either way.)

    Can you offer me some direction on executing the search? The custom taxonomy is showing in the filter bar (custom taxonomy=’neighborhood’) but when I click on an option I get no results. My url is “…?action=tribe_event_day&tribe-bar-date=2017-10-04&tribe_neighborhoodcustom%5B%5D=101”. I’ve used the code discussed in my initial post to implement the filter. I’ve tried many versions of the query (i.e. &neighborhood, &tribe_neighborhood, etc.). Do you know where I might check to get back on track?

    #1359326
    Cliff
    Member

    tribe_neighborhoodcustom is definitely the URL query arg, but you shouldn’t be guessing how to get to it. You should be using Filter Bar to generate the URL(s) for you, at least to get started.

    Does Filter Bar display your custom filter and the expected choices?

    If so, it should generate the appropriate URL for you, like …&tribe_neighborhoodcustom=101 and then display the expected events.

    Is it that everything’s working except the results aren’t what are expected?

    #1359340
    Todd
    Participant

    Thanks Cliff, yes that’s correct.. I’m getting what looks like the correct URL (it is similar to what other working URLs look like when I check different filters) but with this one I get zero results. The non-working URL is this:
    /events/2017-10-05/?action=tribe_event_day&tribe-bar-date=2017-10-05&tribe_neighborhoodcustom%5B%5D=101

    #1359341
    Todd
    Participant

    This reply is private.

    • This reply was modified 6 years, 6 months ago by Todd. Reason: adding pastebin
    #1359404
    Cliff
    Member

    This reply is private.

    #1360991
    Todd
    Participant

    This reply is private.

    • This reply was modified 6 years, 6 months ago by Todd.
    #1361311
    Cliff
    Member

    This reply is private.

Viewing 15 posts - 1 through 15 (of 16 total)
  • The topic ‘Adding Custom Taxonomy to Filter Bar’ is closed to new replies.