A facet allows you to filter, load, sort or reset content. A facet is always attached to a grid (or template) because a page/post can contains several grids (or templates). It can be rendered on a page without the presence of a grid. In this guide, we will show you the main steps to create a facet filter.
Set up facet actionSet up facet action
At first you need to select which kind of action your facet will apply on your grid:
- Filter content from Taxonomy terms, WordPress fields or custom fields
- Load content with a pagination or load more button
- Sort content from WordPress fields or custom fields
- Apply selected filters or redirect to a filtered page
- Reset selected filter values and refresh content
Set up filter facetSet up filter facet
If you set filter as facet action, you need to set the data source of your filter. It means that you need to set which kind of data from WordPress will be used to filter your grid content. You can filter by:
- Taxonomy terms
- WordPress field
- Custom field
You will also be able to set the number of choices diplayed in your facet thanks to Choices Number settings. Depending of the filter type, you will be able to limit the number of choices displayed on load thanks to Limit Choices Number option. If Limit Choices Number is inferior to the Choices Number then a toggle button will be displayed at the bottom of the facet to show more choices on click.
All other facet settings have descriptions in the admin interface and are self explanatory. Each facet action and filter has its own settings.
Index facetIndex facet
In order to efficiently filter content, each facet are indexed in an custom index table. It means, that everytime you create a facet, the plugin automatically queries and stores all facet values according to your facet settings. This process is called indexing and simply allows to “prefetch” results and to store them in a simple and indexed table.
Sometime, you may need to manually re-index your facets. You can re-index each facet independently in facet settings page or in facets overview page:
At any time, you can also stop the indexer or clear the index table in order to start re-indexing your facets if any issue occured. You will find, under Settings > General panel, buttons to stop the indexer and to clear the inde table: