Create a Facet

IntroductionIntroduction

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: Refine displayed content by selecting specific criteria like categories or tags.
  • Sort: Arrange content by criteria such as date or price for easier navigation.
  • Load: Dynamically load content without refreshing the page.
  • Reset: Revert the content to its default state, clearing applied filters.
  • Apply: Apply filters by clicking a submit button or redirecting to a filtered page.
Set up a facet action
Facet settings – Facet action

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
Set up facet data source
Facet settings – Data source

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.

Set up number of choices
Facet settings – Choices number

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:

Re-index a facet
Facet settings – Re-index
Re-index all facets
Facets overview – Re-index

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:

Global settings - Indexer
Plugin settings – Indexer