Translating "the title" of a filter in filterbar

Home Forums Calendar Products Filter Bar Translating "the title" of a filter in filterbar

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #920889
    bitfactory
    Participant

    Hi,
    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?

    #922302
    Brook
    Participant

    Howdy 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

    #922338
    bitfactory
    Participant

    Hi 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.

    #922509
    Brook
    Participant

    No 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

    #940681
    Brook
    Participant

    Since 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

Viewing 5 posts - 1 through 5 (of 5 total)
  • The topic ‘Translating "the title" of a filter in filterbar’ is closed to new replies.