This is the new temporary home of all things related to the free version of Search & Filter – the one found on wordpress.org.
This version works via shortcodes only – no admin UI.
Please see below for usage instructions.
We’re currently updating both free and pro editions with version 3.0 – check out this blog post for more information and to get involved with testing.
Looking for more features?
Including custom fields, drag and drop admin UI, ajax search + much more.
Table of contents
Get Search & Filter free edition
The fastest way to get Search & Filter is simply to search for the plugin by going to the `plugins` section in the WordPress admin of your installation, selecting `add new` and searching for `Search & Filter`. Otherwise head over to the Search & Filter on the WordPress Plugins repo and download from there.
Installation
The quickest installation is via the WordPress admin section of your site, alternatively grab a download before proceeding
Via WordPress Admin: Head to the `Plugins` menu, select `add new` and search for `Search & Filter`. Ensure the plugin is by `Designs & Code` and press `Install Now`.
– OR -Via Download: Upload the entire `search-filter` folder to the `/wp-content/plugins/` directory. Activate the plugin through the `Plugins` menu in WordPress.
How To Use
Search & Filter free works as a WordPress shortcode so it’s as simple as configuring the shortcode and setting your preferences!
As a Shortcode
At its most basic implementation it looks like this:
[searchandfilter fields="search,category,post_tag"]
In a Theme File
To use this within a theme file you simple need to call the `do_shorcode` function with the shortcode above:
<?php echo do_shortcode('[searchandfilter fields="search,category,post_tag"]'); ?>
Options
You can use any combination of these in your shortcodes, the only required option is `fields`.
Name | Default | Options | Notes |
---|---|---|---|
fields | Comma seperated list of any field names and Public Taxonomies:search post_date post_types *public taxonomy names | Fields will be display in the order shown | |
types | select | Comma seperated list of any of the types found below: select checkbox radio These types should only be used when the field is `post_date`:date daterange | Order of `types` will match order of fields |
headings | Comma seperated list containing any string value. Blank values are ommited completely and the label will not display. | Order of `headings` will match order of fields | |
hierarchical | 0 | Comma seperated list. 1 – display as hierarchical * any other value is ignored | Order of `hierarchical` will match order of fields |
hide_empty | 1 | Comma seperated list. 0 – Shows empty taxonomies 1 – Hides empty taxonomies *Any other value is ignored | Order of `hide_empty` will match order of fields |
order_by | name | Comma seperated list of the following possible values: ID name slug count term_group This uses the values of “orderby” as defined on the WordPress site. | Order of `order_by` will match order of fields |
order_dir | ASC | Comma seperated list containing: ASC – ascending DESC – descending This sets the order of taxonomies terms for a given taxonomy and can be used in conjunction with `order_by`. | Order of `order_dir` will match order of fields |
all_items_labels | Comma seperated list containing any string value. Leaving blank for a field will revert to default behaviour. | This is the placeholder text that appears when choosing to search “all” of a term – ie an unfiltered search.When using a select drop down for example this is the text that appears in the first position in the dropdown – ie – “All Categories”Order of `all_items_labels` will match order of fields | |
show_count | 0 | Comma seperated list containing: 0 – Hide count 1 – Show count * any other value is ignored | This shows the number of posts/items within a taxonomy term in brackets after the term.Example:Oranges (10) |
operators | AND | Comma seperated list containing: AND – results shown must be IN ALL terms OR – results shown can be IN ANY of the terms | The operator used when selecting multiple terms. This only applies when using multiple select inputs such as checkbox or multiselect.Order of `operators` will match order of fields |
post_types | Comma seperated list of all post types for filtering, or simply set to `all` to include all post types. | This can be used with or without `post_type` appearing in the field list.When `post_type` appears in the field list, the post types listed here will be selectable in the `post_type` field.When `post_type` does not appear in the field list, then all searches are retricted to the post types here. | |
class | Any string | Enter a class name here to add it to the Search & Filter form.Ommit to ignore. | |
submit_label | Submit | Any string | This is the text label on the submit button. |
search_placeholder | Search … | Any string | This is the placeholder text that appears when no search term has been entered in the search field |
empty_search_url | Any URL or ommit for default behaviour | When a users submits the search form without any search preferences selected (a blank search) they will be redirected to this URL | |
add_search_param | 0 | Can be a value of `1` or `0` for true or false | Setting to true will force a “?s=” or “&s=” to be added to the url even when the search is blank – this may help with the loading of search templates in some themes |
Examples
Minimal with `Category` and `Post Tag` as dropdowns
[searchandfilter fields="search,category,post_tag"]
Headings for Categories and Tags
Notes: Label omitted for the `search` field
[searchandfilter fields="search,category,post_tag" headings=",Categories,Tags"]
Change the submit button label
Notes: `search` field omitted
[searchandfilter fields="category,post_tag" submit_label="Filter" headings="Categories,Tags"]
Custom taxonomies as dropdowns
[searchandfilter fields="search,category,post_tag,taxonomyone,taxonomytwo"]
Radio buttons and headings
[searchandfilter fields="search,category,post_tag" types=",radio,radio" headings=",Categories,Tags"]
Checkboxes and headings
[searchandfilter fields="search,category,post_tag" types=",checkbox,checkbox" headings=",Categories,Tags"]
Minimal with Post Date
[searchandfilter fields="search,post_date" types=",date" headings=",Post Date"]
Minimal with Post Date Range
[searchandfilter fields="search,post_date" types=",daterange" headings=",Post Date"]
Minimal with Post Types
[searchandfilter fields="search,post_types" post_types="post,page" headings=",Post Types"]
Using `order_by` and `order_dir`
Notes: Categories are ordered by ID, ASC and Tags are ordered by NAME, DESC
[searchandfilter fields="search,category,post_tag" order_dir=",asc,desc" order_by=",id,name" types=",checkbox,radio" headings=",Categories,Tags"]
Using `hierarchical`
[searchandfilter fields="search,category" types=",checkbox" hierarchical=",1" headings=",Categories"]
Putting it all together
[searchandfilter fields="search,category,post_tag,post_format,taxonomyone,taxonomytwo" types=",radio,checkbox,select,radio,select" hierarchical=",1" headings=",Categories,Tags,Post Format,Taxonomy One,Taxonomy Two" submit_label="Filter"]
Changelog
1.2.0
- WARNING – this update includes some major changes to shortcode construction, do not upgrade until you have read how this will affect your setup – updating should be easy.
- Renamed the `taxonomies` argument to `fields` – `taxonomies` is now no longer appropriate as this list contains field types other than taxonomies – this list now contains taxonomies, `post_type`, `post_date` and `search` – `taxonomies` as an argument is still supported however will be deprecated
- Search box can now be positioned anywhere, simply include `search` in the fields list in the position desired. Upgrading from previous versions will cause you to lose your search box, simply include `search` in the fields list to show it again
- Drop support for `search` argument as no longer relevant – control display of search input by adding it to the `fields` list
- Labels have been completely rewritten – `label` has been renamed to `headings` to avoid confusion with internal taxonomy labels – the `headings` argument now allows for any text to be added and displayed as a heading for each field – this allows for much more flexibility and no longer uses internal taxonomy labels – to hide a label simply leave blank
- Added support for hierarchical taxonomies for all input types – checkbox, radio & select
- Added support for ordering of taxonomies – use `order_by` argument – allowed values are `id`, `name`, `slug`, `count`, `term_group`
- Added support for ordering direction of taxonomies – use `order_dir` argument – allowed values are ‘asc’ or ‘desc’
- Added support to show or hide empty taxonomies – use `hide_empty` argument
- Added support for `search_placeholder`
- Updated `post_date` functionality to work with older versions of WP – can be displayed either as `date` or `daterange` – the `post_date` field uses the HTML 5 input type of `date` – browsers that do not support it will simply show a text box – a tutorial of integrating jquery for graceful degredation is in the works
- Renamed `submitlabel` to `submit_label` – `submitlabel` still works for now.
- Renamed `type` to `types` – `type` still works for now.
- Updated display of checkboxes and radio buttons, inputs are now wrapped in an unordered list which may affect your styling
- Various bug fixes
- Thanks to `bradaric` for help with hierarchical dropdown lists and date input types – https://github.com/bradaric
1.1.3
- Added support for post_date to be displayed either as date or daterange (WP 3.7+) type
1.1.2
- Added support for all public and custom post types (the attachment post type is excluded) – all post types can be user searchable or predfined and hidden from the user. This allows for users to add multiple search widgets to their site which work on specific post types independantly from eachother.
- Added offical updated documentation (this document), created and moved to Search & Filter Docs
1.1.1
- Fixed: when submitting an empty search/filter, “?s=” now gets appended to the url (an empty search) to force load a results page, previously this was redirecting to the homepage which does not work for many use cases
1.1.0
- Added support for checkboxes and radio buttons, with the option to control this for each individual taxonomy.
- Added support to show or hide headings for each individual taxonomy.
- Added support to pass a class name through to Search & Filter widgets, this allows styling of different instances of Search & Filter
- Fixed problems with escaping output in search box
- Notice: This update will automatically add headings to taxonomy dropdowns, refer to usage and examples on how to disable them.
1.0.3
- Added some documention & screenshots to plugin page
1.0.2
- Version bump for WordPress plugins site
1.0.1
- Updated to use
label->all_items
in taxonomy object for dropdowns before usinglabel->name
- Notice: This update may cause some labels/headings to break, ensure you have set up your taxonomy properly including setting
label->all_items
1.0.0
- Initial Release