WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Changing default text on Search button in sidebar (3 posts)

  1. nickharambee
    Member
    Posted 2 years ago #

    Hi,

    I am trying to change the default text (value) on the Search button for the default search widget in my sidebar from 'Search' to 'Search Website'. From some googling around it would seem that adding this function to my child theme (of the default Buddypress theme) should do it:

    add_filter('get_search_form', 'new_search_button');
    function new_search_button($text) {
    $text = str_replace('value="Search"', 'value="Searcg Website"', $text);
    return $text;
    }

    However the text doesn't change. Could some help with this?

    Thanks,

    Nick

  2. bcworkz
    Member
    Posted 2 years ago #

    If your theme has a searchform.php template, the filter never triggers. In such a case, if you copy the template to your child theme, you can edit it any way you like, and it will be used instead of the parent's template.

  3. nickharambee
    Member
    Posted 2 years ago #

    Thanks bcworkz. That sorted it nicely!

Topic Closed

This topic has been closed to new replies.

About this Topic