Forums › Forums › Search & Filter Pro › using string to translate text in within filter
- This topic has 25 replies, 3 voices, and was last updated 6 years ago by
Trevor.
-
Anonymous(Private) June 17, 2019 at 4:12 pm #214211
Hello, No I am not using any translation plugin. I am wanting to translate manually as so the translation is as accurate as possible. I was hoping to add a custom string to either the post type or the function.php so it will replace a specific word within the filter to the translated version.
Thanks
Trevor(Private) June 17, 2019 at 4:24 pm #214215Frontend or backend? If it is frontend, that will get complicated. Backend, I am not sure it is possible. Front option terms can be manually changed using a filter (https://searchandfilter.com/documentation/action-filter-reference/#filter-input-object). But some other form elements cannot (like the headings) – you may need to use JavaScript to do this, and might not be ideal..
Anonymous(Private) June 17, 2019 at 4:37 pm #214227Hello Sorry I was talking about frontend, as reference you can take a look at this link. I only need to translate the filter options now.
https://extensions.brookstonesites.co.uk/downloads_frenchAnonymous(Private) June 19, 2019 at 9:56 am #214427I am trying this code from the documentation you supplied. However it just removes all the options.
How can I use this correctly?<?php function filter_input_object($input_object, $sfid) { foreach($input_object['options'] as $option) { if($option->value=="brochures") {//the option with no value is always the "all items" or unselected state $option->label = "Brochures"; } else if($option->value=="brochures") {//we want to change the label for the option "black" - we can feed back in the count number to the label for this field type $option->label = "test (".$option->count.")"; } } } add_filter('sf_input_object_pre', 'filter_input_object', 10, 2); ?>
Trevor(Private) June 19, 2019 at 11:20 am #214449I think you need to take a look at some of the snippets shown in this search:
https://support.searchandfilter.com/forums/search/sf_input_object_pre+label+option/
Trevor(Private) June 19, 2019 at 12:17 pm #214453Co authors plus is a plugin that allows more than one author of a post. That paricualr author needed to add more authors to the list. It would not be relevant to you, except to, as all snippets may, offer some ideas. In your case, you are not trying to delete an option, merely to change its label.
-
AuthorPosts