Condition Builder

The condition builder is the base and the most important part of WP Brain, it’s where you build the conditions that control the display of elements.

In WP Brain, a condition is a group of rules linked via logic operators AND/OR. The result of condition will be either true or false. If the validation succeeded, the elements will be shown, otherwise, the elements wrapped by the next fallback container (WP Brain Else) will be shown instead.

Logical Operators

Understanding the logical operators is a must have when you build conditions, but in WP Brain they pretty simple to get in hand and master their usage.

As we said above, a conditions is a group of rules, these rules are linked to each other via what we call a logical operator. WP Brain use two operators:

AND: This logical operator will assure that all of linked rules and sub-groups are valid. When used in main condition, if any of them are not valid, then the validation will fail. But if used a sub-group, it will be valid if all rules are valid too.

OR: Unlike the first operator, this one will make sure that just one rule or sub-group is valid to validate the condition and stop going throughout the rules tree. and the same apply to the validation of sub-groups.

The Condition builder is designed in way that simplify the use of these operators with a tree of lines that illustrate the links between the rules and an operator, so the hardest part is learning how to make combination of both operators to build your desired conditions.

Rule Comparators

Each rule in WP Brain must contain a comparator to allow validation of the real filter value against the given value, these comparators are enabled based on the type of the value, for example numeric value accept extra comparators than boolean values.

Trying to cover almost every logic comparison you will think about, WP Brain now support the following 22 comparators:

wp-brain-operators

These operators require different number of values and inputs, while some of them require two value (the case of “between” operator), others doesn’t need any value (i.e. Is empty, Is not empty, Is null, Is not null, Yes and No).

Note:

The Regular expression is and advanced operator that should be used only by experts who know what that mean. If you need more details please contact the support.

Built-in Filters

WP Brain come with lot of handy and useful filters out of the box, you can achieve unlimited possibilities with these built-in filters, all you have to do is find the right combination for your logic conditions.

  • Page: show content only on some specific website pages
  • Page Template: show content based on page templates
  • Post Type: filter content visibility based on post type
  • Taxonomy: show content only in some taxonomy archives
  • Device: show different content on different devices
  • Operating system: control content for each operating system
  • Browser: control content visibility based on the visitor’s browser
  • Browser version: control content visibility based on the visitor’s browser version
  • Logged in: show content only for logged in members
  • User: filter content by specific user IDs
  • Role: this filter help you target members based on their role
  • Country: display content based on the visitor country
  • Region: restrict content visibility only to some region or states
  • City: restrict visibility based on the visitor’s city
  • Continent: restrict content visibility only to some continents
  • IP Address: restrict content visibility using the IP address of the visitor
  • Date: show content for specific date range
  • Time: show content during a time period
  • Minute: control the visibility of elements by the clock minute
  • Hour: control the visibility of elements by the clock hour
  • Day: control the visibility of elements by the calendar day
  • Day of week: control the visibility of elements by the day of week
  • Month: control the visibility of elements by months
  • Year: control the visibility of elements by year