Support Forums

The forums are closed and will be removed when we launch our new site.

Looking for support? You can access the support system via your account.

Brookstone Creative

Forum Replies Created

Viewing 10 posts - 1 through 10 (of 28 total)
  • Brookstone Creative in reply to:
    using string to translate text in within filter
    #214761

    Thanks for you help on this 🙂

    Brookstone Creative in reply to:
    using string to translate text in within filter
    #214759

    Hello 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);
    Brookstone Creative in reply to:
    using string to translate text in within filter
    #214554

    Ignore 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

    Brookstone Creative in reply to:
    using string to translate text in within filter
    #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

    Brookstone Creative in reply to:
    using string to translate text in within filter
    #214510

    Thankyou

    Brookstone Creative in reply to:
    using string to translate text in within filter
    #214482

    I have tried it in the functions.php but I cant seem to get it to change word ‘Brochures’ to ‘Test’

    This is the code I have used am I missing something?

    <?php
    function my_plugin_search_filter_change_label($input_object, $sfid) {
      if ($sfid == 845 && $input_object['name'] == '_sft_file_type[]') {
        foreach ($input_object['options'] as $key => $option) {
          if ($option->label == 'Brochures') {
            $input_object['options'][$key]->label = 'Test';
          }
        }
      }
      return $input_object;
    }
    add_filter('sf_input_object_pre', 'my_plugin_search_filter_change_label', 10, 2);
    ?>
    Brookstone Creative in reply to:
    using string to translate text in within filter
    #214467

    Okay thanks where would I put this code, could I use it in the archive-downloads_french.php post type theme or does it go somewhere else?

    Brookstone Creative in reply to:
    using string to translate text in within filter
    #214457

    I have found this however it as sfid ==12345 what do you use to replace 12345? Would this be a more correct snippet.

    function my_plugin_search_filter_change_label($input_object, $sfid) {
      if ($sfid == 12345 && $input_object['name'] == '_sf_post_type') {
        foreach ($input_object['options'] as $key => $option) {
          if ($option->label == 'Media') {
            $input_object['options'][$key]->label = 'Photos';
          }
        }
      }
      return $input_object;
    }
    add_filter('sf_input_object_pre', 'my_plugin_search_filter_change_label', 10, 2);
    Brookstone Creative in reply to:
    using string to translate text in within filter
    #214455

    Hello is there a particular post that cant help me with this. I am looking at all the php and I have not an idea which I need to get it to swap out text in the labels of the filter.

    Brookstone Creative in reply to:
    using string to translate text in within filter
    #214451

    Hello from there snippets what is co authors plus? what would I replace this with in my case.

    Thanks

Viewing 10 posts - 1 through 10 (of 28 total)