WordPress has a simple function to build a search form for your blog and in this tutorial I’ll show you how to add a category filter to it.
< ?php get_search_form(); ?>
This function will look for a file called searchform.php inside your template folder: if it doesn’t exist it will output the standard search form. So, if it isn’t already in place, create your custom searchform.php and copy into it the default search form output. It should look similar to this:
<form role="search" method="get" id="searchform" action="<?php bloginfo('siteurl'); ?>"> <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>