function wpbsearchform( $form ) { $form = '<form role="search" method="get" id="searchform" action="' . home_url( '/' ) . '" > <div><label class="screen-reader-text" for="s">' . __('Search for:') . '</label> <input type="text" value="' . get_search_query() . '" name="s" id="s" /> <input type="submit" id="searchsubmit" value="'. esc_attr__('Search') .'" /> </div> </form>'; return $form; } add_shortcode('amitworkdesk', 'wpbsearchform'); Now add [amitworkdesk] as a shortcode in anywhere you want the search bar.
How to Add Search Form in your Post with a WordPress Search Shortcode
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment