Conditional Logic

Learn how to create dynamic content that responds to the type of user viewing it.
← Back to Extensions

Conditional Logic is an extension of the Forge page builder plugin. It is primarily aimed at displaying or hiding specific elements in your layouts, according to certain conditions.

With Conditional Logic, you can create content that changes depending on who is viewing it. For instance, you can create a number of elements that are only shown to registered users, or maybe only to subscribers of your newsletter.

How Conditional Logic Works

Once you purchase and install this extension on your WordPress website, you can open up the page builder interface like always. When you edit an element, you will see an additional group of settings called Conditional Logic at the bottom. Click on this group to open it, and you will be presented with all the options to control that element’s visibility.

Conditional Logic is fairly straightforward. Based on the settings you choose for the current element, it will either display it like normal, or hide it completely. If a hierarchical element (that contains other elements inside of it) is hidden, it won’t display its children either.

Setting Up Conditions For An Element

To create conditions on an element, first you must set the Element Display field, located at the very beginning of the settings list. This field is very important because it determines how the other settings interact with each other. It has six possible values:

  • Show Always. This ignores conditions altogether and always displays the element.
  • Show When Any Condition Applies, meaning only one option needs to be valid to display that element.
  • Show When All Conditions Apply, which means all conditions have to be met or the element will remain hidden.
  • Hide Always. This ignores conditions as well, and keeps it hidden.
  • Hide When Any Condition Applies. Only one option needs to be valid to hidea away the element.
  • Hide When All Conditions Apply, requiring all conditions for the element to be hidden.

As you can see, Conditional Logic gives you a lot of freedom to set up numerous conditions. Be aware that the ‘Show‘ options will keep the element hidden if the conditions are not met. On the other hand, ‘Hide‘ options will display the element unless the conditions are met.


Share on FacebookShare on Google+Tweet about this on TwitterShare on LinkedInShare on TumblrBuffer this pageEmail this to someone

Error: Please enter a valid email address

Error: Invalid email

Error: Please enter your first name

Error: Please enter your last name

Error: Please enter a username

Error: Please enter a password

Error: Please confirm your password

Error: Password and password confirmation do not match