Home › Forums › Calendar Products › Filter Bar › Translating "the title" of a filter in filterbar
- This topic has 4 replies, 2 voices, and was last updated 11 years, 3 months ago by
Brook.
-
AuthorPosts
-
December 17, 2014 at 4:30 am #920889
bitfactory
ParticipantHi,
I use WPML for translation purposes, but i can’t seem to translate the name of a filter title. Since my site is dual language, i placed the english term in WP admin, but i cannot seem to be able to translate it. I know it’s a database entry, so i wasn’t expecting it to be translate-able with WPML, but adding the add_filter(‘gettext’, ‘theme_filter_text’, 1, 3); (like described in other forum post) doesn’t help either, i can translate everything except the title…It’s the filter by category title btw.
Can anyone advise?
December 17, 2014 at 10:43 pm #922302Brook
ParticipantHowdy bitfactory,
That’s a great question. I recently had to do something similar. My solution was to tap into the filter tribe_get_option and dynamically change the content from there if it matched. Another, probably better filter for your specific case would beĀ “tribe_events_filter_title”. All filterbar filter titles should be run through that. If it matches, say Category or whatever you’ve named it, you can swap it out.
Does that make sense?
Cheers!
– Brook
December 18, 2014 at 12:58 am #922338bitfactory
ParticipantHi Brook,
I guess i wasn’t to clear with my question, i’m looking for a way to change
<h3 class="tribe-events-filters-group-heading"><span></span>FILTER TITLE HERE</h3>This is where the title of the filter is showing.
December 18, 2014 at 8:02 am #922509Brook
ParticipantNo problem! I actually think I understood you. However, my response might have been a bit confusing. Anytime you talk about WP Filters and Filter bar filters in the same sentence, it gets confusing when you just refer to one of them as “filter”.
To change that bit of text you would want to use one of the WP Filters I mentioned, currently you are trying the gettext WP Filter which would not apply to these. Here is an example using “tribe_events_filter_title”:
function tribe_change_filterbar_filter_title ($title) { if ($title == 'Event Category') { $title = 'My custom text'; } return $title; } add_filter('tribe_events_filter_title', 'tribe_change_filterbar_filter_title');Does that make sense now? Are you able to modify that example code to get you what you need? Cheers!
– Brook
February 6, 2015 at 9:24 pm #940681Brook
ParticipantSince this topic has gone for a spell without and update I am going to archive. If however you still need anything please feel free to open a new topic and we will be happy to help.
Cheers!
– Brook
-
AuthorPosts
- The topic ‘Translating "the title" of a filter in filterbar’ is closed to new replies.
