WordPress Custom Search Form

/** * Custom Search Form ************************************************************************ */ function custom_search_form( $form ) { $form = '<form method="get" class="search-form" action="' . home_url( '/' ) . '" > <input class="search-field" type="text" placeholder="" value="' . get_search_query() . '" name="s" /> <button type="submit" class="search-submit"><i class="fa fa-search"></i></button> </form>'; return $form; } add_filter( 'get_search_form', 'custom_search_form' );
Basic rewrite of the get_search_form() function to allow custom search forms.

Be the first to comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.