Display search form using searchform.php Theme file.



If you don’t have searchform.php in your Theme, WordPress will render its built-in search 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" />

The above form is used on HTML4 websites. If your theme supports HTML5, which happens if it uses add_theme_support(‘html5’, array(‘search-form’)); it will output the following HTML form. This is the case since WordPress 3.6.

<form role="search" method="get" class="search-form" action="<?php echo home_url( '/' ); ?>">
		<span class="screen-reader-text">Search for:</span>
		<input type="search" class="search-field" placeholder="Search …" value="" name="s" title="Search for:" />
	<input type="submit" class="search-submit" value="Search" />