Adding Custom Filter to Filter Bar – States and Countries

Home Forums Calendar Products Filter Bar Adding Custom Filter to Filter Bar – States and Countries

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #1002517
    Paul
    Participant

    Hi,

    I’d like to add a new filter for “States” and “Countries” . I am using the category filter for various Sports. I’d like for visitors to search for events by either sport or by state/country. This would also allow me to set up email lists for either a Sport category or by state/country category.

    Can you please tell me how to add a new filter to display like below? or when will this functionality be made available within the standard product? Thanks for your help!!

    USA
    -Alaska
    -Arkansas
    -Arizona

    Canada
    -Alberta
    – British Colombia

    Belgium

    Denmark

    Finland

    #1002642
    Josh
    Participant

    Hey Paul,

    Thanks for reaching out to us!

    This can be accomplished with some custom coding. You can add additional filters by using the “tribe_events_filters_create_filters” hook. For constructing the actual filter, I would dig into the existing code for the category filter. You can find that in the src > Tribe > Filters > category.php within the Filter Bar plugin.

    Here is an example of what that may look like when it is pulled together https://gist.github.com/rliverman/f6ee4d51126a005a66ea.

    The above is untested but should give you a good idea on how to move forward with what you’re trying to accomplish.

    Let me know if this helps.

    Thanks!

    #1002651
    Paul
    Participant

    Hi Josh,

    Thanks for the quick response over the holiday. That is over my head.

    I am fine editing and creating new files but I’d need some specific instructions (no php knowledge or fmailiarity working with hooks). There seems to be a much simpler solution as provider by forum user Jorditost in this thread: https://theeventscalendar.com/support/forums/topic/adding-a-custom-filter/

    Can you tell me if his solution is what I am looking for? If so I think the instructions / file paths need to be updated for the current versions of the TEC plugin.

    Thanks for your help!

    #1002656
    Paul
    Participant

    To clarify, I guess the first question should be, how do I add a new taxonomy / category for Countries + states that works like the default event categories?

    Then – how do I get that as a separate item in the filter?

    #1002994
    Josh
    Participant

    Hey Paul,

    Thanks for following up with us.

    1. You can create the taxonomies by following the great information found for the register_taxonomy function in the WordPress codex. You can create the taxonomies that you want and ensure that you assign them to the “tribe_events” post type.
    2. Try following the examples from above from implementing. If you have any specific hiccups along the way, I’ll be happy to try to work those out with you.

    Thanks!

    #1007820
    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 6 posts - 1 through 6 (of 6 total)
  • The topic ‘Adding Custom Filter to Filter Bar – States and Countries’ is closed to new replies.