GenerateBlocks 2.0 is here - Read the release post

Conditions

The Conditions system in GenerateBlocks Pro allows you to control when and where your content appears on your WordPress site. You can create conditional rules based on site location, user roles, device types, dates and much more.

You can create as many conditions as you require and attach them to any content that supports Display Conditions. Updating an existing Condition will apply to content that is attached to it.

Conditions for Overlay panels only today

In the current release Conditions are only applicable to the Overlay Panels feature for building popups, modals, popovers, mega menus and off canvas panels. There are more condition supporting features on the way.

Getting Started

Accessing and Creating your first Condition

  1. Navigate to GenerateBlocks > Conditions in your WordPress admin
  2. Click Add New to create your first Condition
  3. Give your Condition a descriptive name
  4. Add your Conditional statements
  5. Save the Condition

Admin Overview

  1. Add New – create a new condition
  2. Manage Categories – open the Category manager
  3. Condition Name – click to edit the condition
  4. Category – the option condition category
  5. Conditions – a snap shot of the conditions, click for quick view
  6. More Options – Edit Condition, Check Usage, Set to Draft, Delete Condition

Using Conditions

Once created, Conditions can be attached to any “content” that supports Display Conditions. A single condition can be applied to as many pieces of content you require.

Example: Attaching a condition to an Overlay Panel

In the figure below you can see an example Overlay Panel, and within it sidebar Options you can choose the Display Condition.

Editing and Adding Conditions on the fly

In the Overlay Panel Options you are able to edit the selected or create new condition:

Edit the selected Condition

Add a new Condition – if no condition is selected

Choosing either option will allow you to edit the condition without leaving the editor.

Invert Condition

The Invert Condition option allows you to display the content if the chosen Condition is false instead of true.

Updating and deleting conditions

Updating Conditions

Edits made to a Condition will be reflected on any content it is attached to. This allows you to update display conditions from one place and affect changes across multiple pieces of content.

Deleting Conditions

Deleting a Condition will remove it from any content it is attached to.

EDITING AND DELETING CONDITIONS

Editing or Deleting a Condition will affect any content the condition it is attached to. We recommend checking a Conditions usage before making changes.

Checking a Conditions Usage

Go to the Condition > More Options > Check Usage to view where the Condition is being used.

Basic Concepts

Conditional statements

A conditional statement is made of three primary parts:

  1. Type – the type of conditional statement.
    Example: Location
  2. Operator – the logical operator to test the statement.
    Example: IS
  3. Rule – the rule to evaluate.
    Example: ENTIRE SITE

Example Simple Conditional statement:

IF LOCATION IS ENTIRE SITE

Conditions: Group

A collection of related conditional statements that work together.

Each new Condition starts with a single Group. A Group can can contain either:

  1. a single conditional statement
  2. multiple conditional statements

Group logic

Determine whether a Condition Group returns true

AND Logic: All conditions in the group must be true

OR Logic: Any condition in the group can be true

Multiple Groups

More complex logic can be created adding Multiple Groups.

Top Level Logic for Multiple Groups

Determine whether a Multiple Condition Group returns true

AND Logic: All Group Conditions must be true

OR Logic: Any Group Conditions in the group can be true

Advanced Controls

Show JSON Format ( Import / Export )

Conditions are stored as post meta in JSON format. Users can examine, copy and import JSON format conditions from the Show JSON Format.

Condition Types and Rules

Location

Control where content appears on your site.

Common Rules:

  • Entire Site: Shows everywhere
  • Front Page: Homepage only
  • Blog: Blog archive page
  • All Singular: Any single post/page
  • All Archives: Any archive page
  • Notification Templates: No Results and 404 error
  • Specific Post Types: Individual posts, pages, products, etc.
  • Taxonomy Archives: Category, tag, or custom taxonomy pages

Advanced Location Rules:

  • Child of: Show on pages that are children of selected pages
  • Parent of: Show on pages that are parents of selected pages
  • Post Categories/Tags: Show on posts with specific terms

Example Use Cases:

  • Show a popup only on the homepage
  • Display different mega menus on pages vs posts
  • Show category-specific content on archive pages

User Role

Target content based on user permissions.

Rules

  • Logged In: Any authenticated user
  • Logged Out: Visitors who aren’t logged in
  • Specific Roles: Administrator, Editor, Author, Subscriber, etc.
  • Capabilities: Users with specific permissions (e.g., “Can Edit Posts”)

Example Use Cases:

  • Show admin-only messages to administrators
  • Display member-exclusive content to logged-in users
  • Hide pricing for logged-in customers

Date & Time

Schedule content or show based on timing.

Rules:

  • Current Date: Specific dates
  • Current Time: Specific times
  • Day of Week: Monday through Sunday
  • Time of Day: Hourly scheduling

Operators:

  • Before: Show until a date/time
  • After: Show starting from a date/time
  • Between: Show within a date/time range
  • On: Show exactly on a date/time

Example Use Cases:

  • Show holiday promotions during specific periods
  • Display business hours information
  • Schedule time-sensitive announcements

Device Type

Target different devices and platforms.

Rules:

  • Mobile: Smartphones
  • Tablet: iPad and similar devices
  • Desktop: Traditional computers
  • iOS: Apple devices (iPhone, iPad)
  • Android: Android devices

Example Use Cases:

  • Show app download buttons only on mobile
  • Display different layouts for tablets
  • Hide complex interfaces on small screens

Query Parameters

React to URL parameters and search queries.

Rules:

  • Custom Parameter: Check for specific URL parameters

Operators:

  • Exists: Parameter is present in URL
  • Does Not Exist: Parameter is not present in URL
  • Equals: Parameter has specific value
  • Contains: Parameter contains text
  • Does not Contain: Parameter does not contain text
  • Starts With: Parameter begins with text
  • Ends With: Parameter ends with text

Example Use Cases:

  • Show special content for `?source=email` links
  • Display campaign-specific messages
  • Display partner-specific content

Referrer

Show content based on where visitors came from.

Rules:

  • Direct Traffic: No referrer (typed URL directly)
  • Custom Referrer: Specific referring domains or URLs

Example Use Cases:

  • Welcome social media visitors differently
  • Show return visitor messages
  • Display partner-specific content

Post Meta ( Custom Fields )

Use custom field values for conditions.

Rules:

  • Custom Meta Key: Any custom field name
  • Featured Image: Has featured image set
  • Page Template: Specific page template

Operators:

  • Exists: Field has any value
  • Does not exist: Field does not have a value
  • Equals: Field matches exact value
  • Contains: Field contains the value
  • Does not Contain: Field does not contain the value
  • Greater/Less Than: Numeric comparisons

Example Use Cases:

  • Show content only on featured posts
  • Display template-specific elements
  • Use custom field flags for special content

User Meta

Target based on user profile information.

Rules:

  • Custom Meta Key: Any user meta field
  • First Name: Users first name
  • Last Name: Users last name
  • Nick Name: Users nick name
  • Biographical Info: User description
  • User Level: User privilege level
  • Show Admin Bar: User has Admin Bar in view

Example Use Cases:

  • Personalize content with user names
  • Show role-specific dashboards
  • Target users by profile completion

Cookie

React to browser cookies and user preferences.

Rules:

  • Custom Cookie: Check any cookie value
  • WordPress Logged In Cookie: Authentication status
  • Comment Author Cookie: Previous commenters

Example Use Cases:

  • Remember user preferences
  • Show return visitor messages
  • Show personalized content

Languages

Multi-language site support.

Rules:

  • Full Locale: Complete language code (e.g., en_US)
  • Language Code: Just language (e.g., en)
  • RTL Language: Right-to-left languages
  • Specific Languages: Popular languages pre-defined

Example Use Cases:

  • Show language-specific content
  • Localize calls-to-action

Site Options

Use WordPress settings in conditions.

Rules:

  • Custom Option: Any WordPress option
  • Site Title: Blog name
  • Site Tagline: Blog description
  • Timezone: Site timezone setting

Example Use Cases:

  • Client control panel to display custom content
  • Display site-specific branding
  • React to plugin settings

Author

Target content based on post authors.

Rules:

  • Author ID: Specific author by ID
  • Author Name: Author display name or username
  • Author Meta: Custom author meta fields
  • Author Profile Fields: First name, bio, etc.

Example Use Cases:

  • Show author-specific calls-to-action
  • Display guest author information
  • Highlight staff vs contributor posts

Multiple Value condition types

Many condition types support selecting multiple values with these operators:

  • Includes Any: Matches if any selected value is true
  • Includes All: Matches only if all selected values are true
  • Excludes Any: Matches if any selected value is false
  • Excludes All: Matches if all selected values are false

Best Practices

Performance Tips

  1. Keep it simple: Use fewer, well-targeted conditions rather than complex nested logic
  2. Order matters: Put most likely conditions first in OR groups

Organization Tips

  1. Descriptive names: Use clear condition names like “Holiday Promotion – Dec 2024”
  2. Categories: Add categories to quickly identify related conditions.

Troubleshooting

Condition Not Working

1. Check that condition is published (not draft)

2. Verify all required fields are filled

3. Test logic with simpler conditions first

4. Check user role permissions

Content Still Showing

1. Verify condition logic (AND vs OR)

2. Check for conflicting conditions

3. Clear any caching plugins

4. Test in private/incognito browser

Performance Issues

1. Reduce number of complex conditions

2. Avoid frequent database queries (post meta with custom values)

3. Use built-in conditions when possible

4. Consider caching strategies

Developer Docs