Select Page
Advertisements

Want to add the WordPress search form in your post or page. Here’s how!

  1.  Open functions.php in your Child Theme and add the following code:
function wpbsearchform( $form ) {
$form = '<form role="search" method="get" id="searchform" action="' . home_url( '/' ) . '" >
<div><label class="screen-reader-text" for="s">' . __('') . '</label>
<input type="text" placeholder="Search video library" value="' . get_search_query() . '" name="s" id="s" />
<input type="submit" id="searchsubmit" value="'. esc_attr__('Search') .'" />
</div>
</form>';
return $form;
}
add_shortcode('wpbsearch', 'wpbsearchform');
  1.  Now insert the following shortcode into a module on any post or page:
[wpbsearch]

That’s it! You should now see the WordPress search form in your post or page.