Search Form into Shortcode

Shortcodes are a great way to display pre compiled content anywhere on your Pages or Posts.

Below is an easy chunk of code that allows you to put the Search Form Widget or get_search_form(); anywhere.
Simply code this chunk and paste it in your functions.php file.

Basic
function search_form_shortcode( ) {
    get_search_form( );
}
add_shortcode('search_form', 'search_form_shortcode');

or you can create a custom Search Form that is unique to the default output

Custom Output
function search_form_shortcode( ) {

    $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_shortcode('search_form', 'search_form_shortcode');

Now you can either put “[search_form]" in your Posts and Pages or you can manually display it using the following:

<?php echo do_shortcode('[search_form]'); ?>

See how to make a Custom Search Form