Template tag for the rescue
Simply use get_search_form( $echo ) for the search form.
This template tag first searches for a searchform.php file in your main theme folder. If there is no such template, then you'll get a default search form. And depending on your input argument, you can echo or just return it for later use. It also has a filter on its end, that contains the complete search form HTML as string: get_search_form with one argument: $form_html.
How and what to use for search form modifications
So if you want to alter the output, just append, prefix, replace whatever...
- use the
get_search_form-filter to pre-/append something or completely replace the form
- use the custom template to build a unique search form
Or get really sophisticated with theme structure and use the filter to load your searchform from somewhere in your nested theme structure:
// In your functions.php
function wpse65934_searchform_location( $form )
{
return get_template_part( 'subfolder/searchform', 'default' );
}
add_filter( 'get_search_form', 'wpse65934_searchform_location' );