Searching for things on WordPress doesn’t have to be a long, slow process with multiple page reloads. Thank God.
Instant Search & Suggest is a plugin that speeds up the search process by calling up information from posts, pages, taxonomies, and custom post types on the fly. They show up as drop-down suggestions under the search box, of course, but the content area can also be repopulated on the fly.
And it can work with just about any theme.
In fact, the plugin’s author makes the bold claim that it should work automatically with around 70% of WordPress themes. So long as the main content area of theme is wrapped in a div or section with the #content ID, you should be all set.
Of course, I had to see if it lived up to the hype. It did.
It tests well
I tested it out with the default Twenty Fifteen theme to start with, and I got good results:
So all’s well and good if your theme was developed by Automattic. However, I had to test it out another theme to be sure. I grabbed one called Point, installed it, and gave it a whirl.
It didn’t work, at least, not right off the bat. I had to go to the settings and change the predefined #content selector to .article. That was all it took. I had instant search working:
Getting technical
You can set the plugin to search everything: posts, pages, categories, and tags. Custom post types and taxonomies are also supported, if you’re building something more complex.
You can, of course, style the little drop-down search results to your hearts content, and what’s more, you can completely customize them. According to the developers:
The plugin has two filters, both of which allow you to customise the search suggestion results. The filters are: `wpiss_post_tempalte` and `wpiss_taxonmy_tempalte`.
You should return a valid [mustache template](https://github.com/janl/mustache.js) to both of these. You can see an example in `assets/inc/iss-theme.php`.
Variables available in your mustache template for posts/cpts are: `title`, `permalink`, `postdate`, `posttype`, `categories` and `image`.
Variables available in your mustache template for taxonomies are: `title`, `permalink`, `taxonomy` and `count`.
Conclusion
It’s a simple and easily-customized solution for modernizing search on your WordPress sites. It’s fast, it’s pretty, it works.