Search within the current page

Question

I’m trying to place a second search bar, along with the main navigation search bar, on a specific page within a site so that I can search just within that page. Per the recommendation of someone, I placed the following code in my functions.php file

add_shortcode( 'search', 'tu_search_shortcode' ); function tu_search_shortcode() { ob_start(); get_search_form(); $ret = ob_get_contents(); ob_end_clean(); return $ret; }

and then added the shortcode [search] to the page.

That worked for putting the search bar on that page where I wanted it, but it still searches the entire site like the general search bar does.

Does anyone know if I can limit the search to that specific page?

0
DanB0328 3 months 0 Answers 50 views 0

Leave an answer