Custom Search Form using "get_search_form"

Here is a simple way to customise the default WordPress output of the Search Form.

The search form can be displayed in may ways. The most common place is in the WordPress Widget Area. Often when you are building a custom site you want the Search Form in the header.

Copy the following code into your functions.php file.

function wpchunks_search_form( $form ) {
    
    $form = '<form role="search" method="get" id="searchform" action="' . home_url( '/' ) . '">
    <input type="text" value="" name="s" id="s" placeholder="SEARCH..." />
    <button type="submit" class="searchsubmit">Search</button>
	</form>';

    return $form;
}

add_filter( 'get_search_form', 'wpchunks_search_form' );

This will change the output of the Search Form Widget and anywhere get_search_form(); is used.

See how to make a Search Form Shortcode