• Resolved inula

    (@janetb)


    Hi,

    Can you tell me what is wrong in this code?
    I would like to change title of Search-input. It is now: ‘Search for:’

    add_filter( 'generate_search_label', 'tu_change_search_label' );
    function tu_change_search_label() {
        return 'Zoeken';
    }
    
Viewing 11 replies - 1 through 11 (of 11 total)
  • Theme Author Tom

    (@edge22)

    Hi there,

    That should work. How are you adding the function?

    Thread Starter inula

    (@janetb)

    Hi there to you too ??

    I have put it in functions.php after changing the placeholder-text:

    /***********wijzig placeholder tekst en title in searchbox************/
    add_filter( 'generate_search_placeholder', 'tu_change_search_placeholder' );
    function tu_change_search_placeholder() {
        return 'Zoeken';
    }
    add_filter( 'generate_search_label', 'tu_change_search_label' );
    function tu_change_search_label() {
        return 'Zoeken';
    }

    Changing the placeholder text works fine.

    Theme Author Tom

    (@edge22)

    Strange – any chance you can link me to the site?

    Thread Starter inula

    (@janetb)

    Sure!
    https://www.filmhuisemmen.nl/nieuw/archief

    • This reply was modified 6 years ago by inula.
    Theme Author Tom

    (@edge22)

    Hmm, should be working.

    Can you try this instead?:

    add_action( 'wp', function() {
        add_filter( 'generate_search_label', function() {
            return 'Zoeken';
        } );
    } );
    Thread Starter inula

    (@janetb)

    Thanks for the effort Tom, but that doesn’t change the label/title either.
    It must be a conflict somewhere. Don’t you think?

    Installed plugin Ajax Search Lite.
    So let’s leave it to this (eventhough that’s one of the hardest things to do…)

    Theme Author Tom

    (@edge22)

    Does it work if you temporarily deactivate all of your other plugins/custom functions?

    Thread Starter inula

    (@janetb)

    Hi Tom,

    Cloned my website, deactivated all plugins, deleted custom functions in functions.php except:

    add_action( 'wp', function() {
        add_filter( 'generate_search_label', function() {
            return 'Zoeken';
        } );
    } );

    Title/label is still ‘Search for:’

    Then I tried the same with:

    add_filter( 'generate_search_label', 'tu_change_search_label' );
    function tu_change_search_label() {
        return 'Zoeken';
    }

    Still the title is ‘Search for:’

    Theme Author Tom

    (@edge22)

    Hmm, yep – looks like a bug in the theme.

    Can you try replacing the searchform.php file in the theme with this?: https://gist.github.com/generatepress/e90ddb8e6bbddf601d2b7025c0a86a1c

    Then that second filter should work.

    Let me know ??

    Thread Starter inula

    (@janetb)

    Problem solved! ??

    Theme Author Tom

    (@edge22)

    Awesome! ??

Viewing 11 replies - 1 through 11 (of 11 total)
  • The topic ‘Label search form (title)’ is closed to new replies.