Raghunath Gurjar

Hello Friends!

Hope you are doing well 🙂

If you want to edit the html of default search form in your wordpress website, then don’t warry 🙂 just add my code in your theme function file.

raghu-blog

/********************************************
 * Start search form hookes part here
*********************************************/
function my_search_form( $form ) {
    $form = '<form role="search" method="get" id="searchform" class="searchform" action="' . home_url( '/' ) . '" >
    <div>
    <input type="text" value="' . get_search_query() . '" name="s" onblur="if (this.value == '') {this.value = 'Search';}" onfocus="if (this.value == 'Search') {this.value = '';}" id="setop"/>
    <input type="submit" id="searchsubmit" value="'. esc_attr__( 'Search' ) .'" />
    </div>
    </form>';

    return $form;
}

add_filter( 'get_search_form', 'my_search_form' );
/********************************************
 * End hookes part here
*********************************************/

Enjoy Code! | Raghunath Blog

View original post