This add-on lets you toggle facets (and other elements) based on certain conditions.

Rulesets

For each action you want to accomplish, you have to create a ruleset. You can do so by clicking the “Add Ruleset” button, which creates an empty ruleset at the bottom of already existing rulesets.

Each ruleset can contain one or more conditions (IF) and one or more actions (THEN).

To capture all scenarios in which the condition(s) is/are not met, each ruleset always has an (ELSE) setting. This setting is located at the bottom of the “Actions” panel and is limited to two options: “Do the opposite”, or “Do nothing”.

Ordering rulesets

Rulesets are applied in the order they appear on the page. You can change the order by dragging and dropping them with the hamburger icon in the top left corner.

Be aware that the rulesets can override each other’s logic and actions. For example, using the Page URI condition in combination with the ELSE: Do the opposite action, can quickly lead to unexpected results.

Disabling rulesets

How to disable rulesets.

By default, new rulesets are enabled.

If you want to (temporarily) disable a ruleset but keep all its settings, uncheck the checkbox in the top left corner and click “Save Changes”.

To permanently delete a ruleset, click the red “x” in the top right corner.

Naming rulesets

How to name rulesets.

You can give each ruleset a name or description to make it easier to distinguish them or remember what they were for.

Click “Change me” to change the label and click “Save Changes” afterward.

Conditions

Conditions determine what to test for (IF). You can use one single condition, or you can combine multiple conditions with AND or OR logic.

If a ruleset has no conditions, then its actions will always be applied.

To capture all scenarios in which the condition(s) is/are not met, each ruleset always has an ELSE setting. This setting is located at the bottom of the “Actions” panel and is limited to two options: “Do the opposite”, or “Do nothing”.

Adding conditions

How to add conditions.

Click the “Add condition” button to add a condition.

Let’s say you want something to happen on yoursite.com/demo/cars/ if the “Make” facet has bmw selected. The example on the right shows the two conditions you need to accomplish that.

Combining multiple conditions

How to add multiple conditions with AND or OR logic.

To string together multiple conditions with AND logic, click the “Add condition” button again.

If you want to use OR logic instead, click the “OR” button to the right of an existing condition.

Available conditions

The following conditions can be selected:

  1. Basic
    • No facets in use
    • Some facets in use
    • Page URI – the URI of the page (which is not the URL, see below).
    • Result count – Enter one number. This condition becomes true if this number is the number of results in the post listing.
  2. Facet Value – Choose a facet and set a value as condition. This condition becomes true if the entered facet choice is selected by the user. It’s possible to enter multiple values, separated by a comma (without any spaces). However, only when these values are all selected, and in that exact same order, the condition becomes true. So the usefulness of this is currently very limited. We recommend combining multiple single-value conditions with AND or OR instead. Tip: the facet’s value you need to enter here can be seen in the URL after you select that facet choice.
  3. Template – Choose a Listing Builder template. This condition becomes true if the selected template is present on the page.

For Page URI, Result count and Facet Value, you can choose between a is or a is not comparison.

Using the Page URI condition

How to use a Page URI condition: don’t use a / at the beginning or end.

If you are using Page URI as a condition, there are a few caveats and things to keep in mind:

  • The Page URI is not the URL of the page. The URI is everything after the domain name, without a slash at the beginning or end, and without query variables. So shop is a valid condition, but shop/ or /shop will not work.
  • If you need to target the home page of your site, leave the Page URI field empty.
  • If you are using multiple rulesets that are using a Page URI condition in combination with the ELSE: Do the opposite action, and they target the same facet, the rulesets will override each other (in the order they are placed on the page). Be aware that ELSE, in this case, refers to all other pages than the one defined with the Page URI condition. In these kinds of scenarios the undesired override can be prevented by using ELSE: Do nothing.
  • Be aware that if you are using a caching plugin, rulesets that are using Page URI as condition will sometimes not work consistently. A solution can be to exclude the page from caching, or to use conditions other than Page URI.
  • If you are using a language in the URL that has encoded characters, for example Greek, you need to use the encoded URI in the Page URI field for it to function correctly.
Using a Page URI wildcard
How to use a Page URI with a wildcard.

The Page URI condition supports a * wildcard, but only at the end, and only one per condition.

For example, shop/* is a valid condition, as is shop* or shop/category-*. But shop/*/ or */brand will not work.

A few things that may be good to know:

  • If you use only the * wildcard, the condition will be true on all pages.
  • shop/brand* will also return true for the Page URI shop/brand.
Targeting pages with a body class

If you need to target specific (batches of) pages, instead of using the Page URI as condition, you can also use the page’s body class in a custom selector.