Home Design / Dev How To Put Text Inside WordPress Search Forms

    How To Put Text Inside WordPress Search Forms

    Many free themes or blog templates out there comes with default search forms that has empty field without any text in its input area. We believe this is fine, but you can see that many themes also have already started to put default text inside the search form field.It has already become a web 2.0 trends and not just being used in search forms but in other form fields also.

    Why text inside search forms?

    The text can actually help readers to identify the search area more easily, encouraging them to use it and even clarify the search process for non-experience users. Some examples of texts that you can include in the search box:

    • search here
    • search
    • To search, type and hit enter
    • search this blog

    How to do it

    Simply locate where is search form code. It can be in sidebar.php, header.php depending on where it is located. Just find this line of code:

    - Advertisement -

    [sourcecode language=’php’]


    - Advertisement -

    Then replace the whole code above with this bunch of code:

    [sourcecode language=’php’]


    With a simple code above will give you a clickable, and then dissapearing text inside the search box, and replaced by the texts you typed. When you click on other side than the search box without typing any text, it will reappear again the default search text.


    Then you can customize the looks of the font and its color by modifying or adding the suitable css stylesheet.

    To get a nice search result, you can go to our previous post:

    READ ALSO:  WordPress 4.2 Has Released: What's in Store For You

    How to Create SEO Friendly Search URL

    - Advertisement -
    Owner of WPTidBits. Totally in love with WordPress!


    Please enter your comment!
    Please enter your name here