Bang Faceted Search
A faceted search is one that allows you to drill down by various fields: price, size, colour, shipping location etc. It complements a free text search rather than replaces it. Using this plugin, you can create a faceted search interface for your pages, posts, or any other custom post type. You can a
About this tool.
A faceted search is one that allows you to drill down by various fields: price, size, colour, shipping location etc. It complements a free text search rather than replaces it.
Using this plugin, you can create a faceted search interface for your pages, posts, or any other custom post type. You can add “facets” for:
- Taxonomies
- Custom fields
- Dates (day, week, month or year)
- Author
These facets are widgets that can be easily changed in the admin interface.
You can have multiple search pages for different post types. If your WordPress installation uses multi-site, you can search across the different sites.
Getting started.
- 01Upload the bang-faceted-search directory to your /wp-content/plugins/ directory
- 02Activate the plugin through the ‘Plugins’ menu in WordPress
- 03Create a template search.php in your theme
- 04Go to Settings > Faceted Search to set up your search pages.
Creating a search page
By default, you’ll have a single search address, at the site root / . This lines up with WordPress search.
In the WordPress admin adrea, go to Settings > Faceted Search. At the top is
Creating a search template
You need to create a search template in your theme called search.php , if you don’t already have one. This template will be used whenever the user searches your site. You can have more than one search template, each.
Add this code to your functions.php to create a search-specific sidebar:
register_sidebar(array( 'name' => 'Search', 'id' => 'search' ));
Your search template should include that sidebar:
<?php dynamic_sidebar('search'); ?>
Then in the admin interface, drag Facet widgets into that sidebar to add, customise and re-order the search widgets for your site.
Customising the faceted search
Your site can have more than the default search page, and you can use the faceted search plugin to search custom post types.
To make a custom search, create a page with a custom template in your theme. For example, if you have a page called /products , then create a template in your theme called products.php . Near the start of this template, call this code: