WordPress LogoI’m working on building an HTML5 WordPress theme that I’ll use as a foundation for all my projects. I’m sort of taking the shoot-first, ask-questions-later approach. That is, I’m using as much HTML5 goodness as I can, and I’ll deal with backwards compatibility later. So, I wanted to use a proper HTML5 search input.

In order to override the default search form, all you have to do is create a file called searchform.php in the root of your theme’s directory. WordPress will pick this up and use it. For reference, my form looks like this:

<form role="search" method="get" id="searchform" action="<?php bloginfo( 'wpurl' ); ?>">
<input type="search" value="" name="s" id="s" results="5" autosave="gg_search" placeholder="Search..." />
<input type="submit" id="searchsubmit" value="Search" />