TransWikia.com

Search within the current page

WordPress Development Asked by DanB0328 on December 31, 2021

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?

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP