Create a Facet

IntroductionIntroduction

A facet allows 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).
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
  • Reset content depending of facets if needed
image
Facet settings – Facet action

Set up filter facet Set up filter facet

If you set filter as facet action, you need to set the source of your filter. It means that you need to set which kind of content from WordPress will filter your grid. You can filter by:

  • Taxonomy terms
  • WordPress field
  • Custom field
Facet Settings- Select filter source
Facet settings – Filter source

You will also be able to set the number of items diplayed in your facet thanks to Filter Number settings. Depending of the filter type, you will be able to limit the number of items displayed on load thanks to Limit Number of Items option. If Limit Number of Items is inferior to the Number of Items then a toggle button will be displayed at the bottom of the facet to show more items on click.

Facet Settings- Set number of facet items
Facet settings – Filter 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 fetches 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:

Facet Settings- Re-index a facet
Facet settings – Re-index
Facet Overview - 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, in Global Settings > General, buttons to stop the indexer and to clear the inde table:

Global Settings- Setup the indexer
Global settings – Indexer