• Hello there,

    I’m a little rusty at WordPress and am wondering how I edit the HTML here? (I can’t find the PHP file)

    <div>
        <label class="screen-reader-text" for="s">Search for:</label>
        <input type="text" value="" name="s" id="s">
        <input type="submit" id="searchsubmit" value="Search">
    </div>

    Essentially I want to add Placeholder text to the middle line so it’s like this

    <input type="text" value="" placeholder="Search Site"name="s" id="s">

    but I can’t find where to edit the PHP ? would it be in the Theme? or the WordPress build itself. Someone suggested using a third party plug in but I thought that surely isn’t best practice

    working Example is here:

    https://bit.ly/17rfdPC

    Any help greatly appreciated

    Kie

Viewing 2 replies - 1 through 2 (of 2 total)
  • Hey kiekelly,

    Check out this page. When the search form is requested via PHP, WordPress checks the active theme for a searchform.php file and displays the contents of it. Failing that, it uses it’s built-in form:

    <form role="search" method="get" id="searchform" action="<?php echo home_url( '/' ); ?>">
        <div><label class="screen-reader-text" for="s">Search for:</label>
            <input type="text" value="" name="s" id="s" />
            <input type="submit" id="searchsubmit" value="Search" />
        </div>
    </form>

    So in your active theme, create a searchform.php file and put this code inside of it:

    <form role="search" method="get" id="searchform" action="<?php echo home_url( '/' ); ?>">
        <div><label class="screen-reader-text" for="s">Search for:</label>
            <input type="text" value="" placeholder="Search Site" name="s" id="s" />
            <input type="submit" id="searchsubmit" value="Search" />
        </div>
    </form>

    And you should be good to go. Let me know how it goes!

    Odai, I tried it and it worked!! Thanks very much!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Editing the Search Widget’ is closed to new replies.