Search a single page
-
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 within just 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?
Or, since this is going to be a gallery of images with titles or captions below the images that link to a page with more info, is there a gallery plugin that has a search option that I could use?
Hope all of this makes sense, but please let me know if it doesn’t and I’ll try to explain better.
Thanks.
The topic ‘Search a single page’ is closed to new replies.