How to modify the searchform.php ?



    I am in the process of integrating Google CSE on my site. I want to replace default search box with the Google one. In order to do that I need to edit, searchform.php in the main theme.

    I don’t have that in my Child Theme, but I do have functions.php …

    Do I have to create a searchform.php file in the Child? If I do so, I can just create it and upload it via FTP while the Child Theme is live?


    Can I modify the searchform.php with,

    <form method="get" id="searchform" action="/blog/gsearch/">
    <label for="q" class="assistive-text">Search</label>
    <input type="text" class="field" name="q" id="q"/>
    <input type="submit" class="submit" id="searchsubmit"/>

    Thank you.


    Syahir Hakim


    Create a searchform.php file in your child theme and add the code you included above. And yes, you can do it while the child theme is live.


    Thank Syahir,

    Now it shows a huge “Submit” button under it. I tried to remove it by modifying this, <input type="submit" class="submit" id="searchsubmit"/> to this <input type="" class="submit" id="searchsubmit"/>

    It broke the code so I went back to what I had original. Could you help me with styling this to look the same as the default search please? Can I do this with CSS?


    Never mind,

    I got it! Completely remove, <input type="submit" class="submit" id="searchsubmit"/> and it works fine with just with keyboard enter.

Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.