Archived topic
Replacing default navigation search / adding AJAX functionality
3 replies · Started by Filip on April 14, 2022
Hello.
The site is https://molitve.rs.
I've also installed the Ajax Search Lite plugin which automatically suggests and shows results as you're typing into it.

Is there any way I could replace the default one with the one I've installed, or add ajax functionality to the native one?
I've also tried this, but it's not working:

Thanks in advance!
Hi there,
the Navigation Search has a separate search form but it has the generate_navigation_search_output filter so you can add your own form:
https://docs.generatepress.com/article/generate_navigation_search_output/
For example you could use this to add a shortcode form:
add_filter( 'generate_navigation_search_output', function() {
return sprintf(
'<div class="navigation-search">%s</div>',
do_shortcode( '[your-search-plugin-shortcode]' )
);
} );
Just swap out the [your-search-plugin-shortcode] with the plugins shortcode.
Thanks a lot, David!
You're welcome