FacetWP Conditional Logic Addon v1.5.1
This add-on lets you toggle facets (and other elements) based on certain conditions.
Same brand
More from FacetWP
Facetwp
by FacetWP
Use FacetWP to add faceted search to your eCommerce sites, resource libraries, s...
Facetwp Multilingual Addon
by FacetWP
If you are using WPML, Polylang or Polylang Pro, download and install the Multil...
Facetwp Submit Button
by FacetWP
Add a submit button that redirects to a separate results page We often get asked...
Related items
Related Filter Plugins
Filter Everything Pro
by FilterEverything.Pro
Filter Everything — WordPress & WooCommerce product filter plugin, that allows t...
Search & Filter Pro – The Ultimate Wordpress Filter Plugin (addons included)
by DesignsAndCode
The Ultimate WordPress Filter Plugin
WooCommerce Product Filter Pro
by WooBeWoo
Create and customize filters for your online store using Free WooCommerce Produc...
This add-on lets you toggle facets (and other elements) based on certain conditions. This video shows two examples: The first ruleset created in this video has no conditions, which means that it will always be applied. It uses an action with a custom selector set to $EMPTY to target empty facets. The second ruleset in the video is an example of a ruleset having multiple conditions and an action that hides one specific facet. 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”. So in “pseudo code”, each ruleset does this: if ( condition#1 == true AND / OR condition#2 == true ) { do action#1 AND do action#2 } else { do the opposite / 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. If the condition contains a facet value, like the second condition in the image on the right, make sure to use the technical value of the facet choice (as seen in the URL when that choice is selected), and not the display value as displayed in the facet itself. 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: 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. 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. Important: The facet value you need to enter here is the “technical value” of the facet choice, as displayed in the URL when that choice is selected. Don’t use the facet choice’s display value (the label as displayed in the facet itself). For example, a facet choice can have the display value “Alfa Romeo”, in which case you need to enter its facet value “alfa-romeo”. Using multiple values in one condition (in OR logic). To use multiple values, separate them with a comma. The condition uses OR logic: it becomes true when one or more of the values is selected. If you want AND logic, you need to combine multiple single-value conditions with AND (or OR) instead. Note that using multiple values in one condition only works in Conditional Logic v1.5+. If you leave the facet value in the condition blank, the condition applies if the facet is (or is not) in use. This makes it possible to create a condition for showing/hiding other facets based on a specific facet having any selections (if you use is not) or not having any selections (if you use is). An example: If you leave the value blank, the condition applies if the facet is (or is not) in use. In this example, the Size facet is hidden if the the Category facet has no selections. 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. Choose your Listing Builder template as condition (or any of the other condition types). Then, under Actions, use a custom selector that targets the body class: How to use custom fUtil code?fUtil is a JavaScript library that comes built-in with FacetWP and is loaded in the footer, only on pages with facets. fUtil code can be placed in your (child) theme's main JavaScript file. Alternatively, you can add it manually between
Recent releases
Release history
Frequently asked questions
Is Facetwp Conditional Logic GPL licensed?
Can I use Facetwp Conditional Logic on multiple websites?
How much does Facetwp Conditional Logic cost on GPLCoffee?
Are updates included with Facetwp Conditional Logic?
Is Facetwp Conditional Logic safe to download?
Auto-updates included
Install it once, update automatically.
The GPLC Connector installs this plugin from your wp-admin and rolls out new versions to your connected sites - up to 25. Included with 12-month and Geek Lifetime plans (plus legacy 6-month).