Advanced search forms are something almost every large site wants, especially since they make it dramatically easier to find content across the site. This is a simple plugin that provides a short code that displays an advanced search form on your site. The search form includes the options to search in any and all post types, tags, categories, and any custom taxonomy. As a short code, it’s extremely simple to setup and you can have an advanced search form added to your site in less than five minutes.
One of the great things about this plugin is that it allows you to add an advanced search form to your site, but without modifying any of your existing functionality. Still want a simple search form? No problem.
The search form is placed on any page with the following short code:
By default, the form will include options to search in categories, tags and all public post types, including both posts and pages. Categories and tags will both be outputted as radio options.
The short code accepts several parameters:
- search_text=”Key Words”
- placeholder=”Enter search terms”
- search_type_text=”Search by Type”
- search_cat_text=”Search by Category”
- search_tag_text=”Search by Tag”
- search_tax_text=”Search by %s”
If you wish to disable the categories, tags, or post types, simply set their parameter to 0, like this:
[advanced_search categories=1 tags=0]
By default, setting post_types to 1 enables all public post types, but since you may not want users to have the option to search in some particular post types, you can simply pass the name of post types to exclude to excluded_post_types, like so:
[advanced_search categories=1 tags=0 excluded_post_types="books,movies"]
With excluded_post_types=”books,movies” neither books nor movies will be available as post types to search in.
You can also enable options to search in any custom taxonomy as well by passing the names of the taxonomies to the taxonomies parameter, like this:
[advanced_search categories=1 tags=0 taxonomies="genres,topics"]
With taxonomies=”genres,topics”, both the Genres and Topics taxonomies will be available as options.
The final parameter, style, lets you define whether the categories, tags, and taxonomies should be shown as radio or select options. To show them as select menus, simply use the short code like this:
[advanced_search categories=1 tags=0 style="select"]