Forums › Forums › Search & Filter Pro › using string to translate text in within filter
- This topic has 25 replies, 3 voices, and was last updated 5 years, 5 months ago by Trevor.
-
Anonymous(Private) June 20, 2019 at 9:03 am #214552
Hello Yes they both appeared but when I refreshed my browser Brochures got replaced with Test so I removed your echo code I added and it was still there so it must have been some kind of caching issue.
At least I know now the codes works in the correct place. May I ask how I can add multiple text replacements in this?
Thanks
Anonymous(Private) June 20, 2019 at 9:12 am #214554Ignore my last message I believe it was because I changed the _sft_file_type[] to _sft_file_type.
I have also worked out how add multiple text. I have tried the same code trying to replace the text on the dropdown menus. I cant seem to get these to work can you help me with those aswell.
Thanks
Ross Moderator(Private) June 23, 2019 at 3:51 pm #214655Hi again
Can you confirm that the orginal label change is now working?
If so, then please provide your updated code, with explanations (comments) of what each part is supposed to do, and I’ll try to tell you where it looks like its going wrong.
Thanks
Anonymous(Private) June 24, 2019 at 3:27 pm #214759Hello to update this I have now got the the code working correctly. Here shows 2 text replacement one after the other.
function my_plugin_search_filter_change_label($input_object, $sfid) { if ($sfid == 845 && $input_object['name'] == '_sft_category') { foreach ($input_object['options'] as $key => $option) { if ($option->label == 'All Categories') { $input_object['options'][$key]->label = 'Toutes Catégories'; } } foreach ($input_object['options'] as $key => $option) { if ($option->label == 'Accessories and Cables') { $input_object['options'][$key]->label = 'Accessoires et Câbles'; } } } return $input_object; } add_filter('sf_input_object_pre', 'my_plugin_search_filter_change_label', 10, 2);
-
AuthorPosts