Home › Forums › Calendar Products › Filter Bar › Adding Custom Filter to Filter Bar – States and Countries
- This topic has 5 replies, 3 voices, and was last updated 10 years, 8 months ago by
Support Droid.
-
AuthorPosts
-
September 6, 2015 at 3:10 pm #1002517
Paul
ParticipantHi,
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
-ArizonaCanada
-Alberta
– British ColombiaBelgium
Denmark
Finland
September 7, 2015 at 9:06 am #1002642Josh
ParticipantHey 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!
September 7, 2015 at 9:14 am #1002651Paul
ParticipantHi 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!
September 7, 2015 at 9:23 am #1002656Paul
ParticipantTo 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?
September 8, 2015 at 10:30 am #1002994Josh
ParticipantHey Paul,
Thanks for following up with us.
- 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.
- 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!
September 23, 2015 at 7:05 am #1007820Support Droid
KeymasterThis 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. -
AuthorPosts
- The topic ‘Adding Custom Filter to Filter Bar – States and Countries’ is closed to new replies.
