General Conditions

BricksExtras adds optional additional conditions in Bricks builder for rendering (outputting) elements conditionally/dynamically depending on different criteria.

All the conditions are disabled by default and users can enable the ones they would like to use thus following our modular philosophy. Find the ‘Conditions’ tab inside the BricksExtras settings.

bricksextras settings2

Note: This page covers General conditions. We have separate doc pages for Membership conditions and WooCommerce conditions.

Table of Contents

Archive type

Render elements depending on the type of archive page being viewed on the frontend.

View: Designed for use in a template that applies to more than 1 type of archive.

CleanShot 2023 07 27 at 12.26.56@2x

Operators: is, is not

At least one search result

Render elements depending on whether there is at least 1 search result or not.

View: Designed for use in search results template.

CleanShot 2023 07 27 at

Operator: is

Authored by logged-in user

Render elements depending on whether the currently logged-in user is the author of the singular page being viewed on the front end.

View: Singular pages of any post type (like page, post, CPT). Also works in query loops.

CleanShot 2023 07 27 at

Operator: is

Author has CPT entry

Render elements depending on whether the current user has published at least one published entry (post) of the selected custom post type.

author has cpt entry bricks condition

Operators: ==, !=

Body classes

Render elements depending on whether the supplied body class is in the list of body element’s classes for the page.

CleanShot 2023 08 02 at

Operators: include, do not include

Category archive

Render elements depending on whether a category archive page being viewed on the front end is that of the selected category.

View: Designed for use in a template that applies to category archives.

CleanShot 2023 07 27 at

Operators: ==, !=

CPT has at least 1 published entry

Render elements depending on whether the selected custom post type has at least one published entry (post).

CleanShot 2023 08 30 at

Current day of month

Render elements depending on whether the current day’s number matches the selected number (1 – 31).

CleanShot 2023 08 02 at

Defaults to the current day’s number.

Operators: is, is not

Current month

Render elements depending on whether the current month matches the selected month (January – December).

CleanShot 2023 08 01 at

Defaults to the current month.

Operators: is, is not

Current year

Render elements depending on whether the current year matches the entered year (number).

CleanShot 2023 08 02 at

Defaults to the current year.

Operators: is, is not.

Current taxonomy term has child

(v1.5.1+) Render elements depending on whether the current taxonomy term being viewed (on the archive page) has child elements.

SCR 20240422 jboi

Defaults to true.

Operators: ‘==’

Date field value

Render elements on singular pages or in the query loop depending on whether the selected Date-type custom field for the current post is in the past or is today or is in the future.

CleanShot 2023 08 30 at

Ex.:

date field value bricks condition

Tested with ACF and Meta Box.

Operators: is in the past, is today, is in the future (default).

For ACF users: Display format and Return format do not matter.

For Meta Box users: Do NOT save the value as timestamp.

Datetime field value

Render elements on singular pages or in the query loop depending on whether the selected Date time-type custom field for the current post is in the past or is in the future.

datetime field value bricks condition

Tested with ACF and Meta Box.

Operators: is in the past, is in the future (default).

For ACF users: Display format and Return format do not matter.

For Meta Box users: Do NOT save the value as timestamp.

Has child category

Render elements on category archive pages depending on whether the current category has at least one child category i.e, whether the current category is a parent or not.

has child category bricks condition

Has custom excerpt

Render elements on posts depending on whether the current post has a custom excerpt set.

View: Singular pages of any post type (like pagepost, CPT) that has support for excerpts enabled. Also works in query loops.

CleanShot 2023 08 02 at

Operators: is, is not

Has post content

Render elements on posts (of any post type) depending on whether the current post has any content in the WordPress editor.

View: Singular pages of any post type (like pagepost, CPT). Also works in query loops.

CleanShot 2023 08 02 at

Operators: is, is not

Is child

Render elements depending on whether the current single page (of any hierarchical post type) is a child of another.

View: Designed for use in singular pages or a template that applies to static Pages or any other post type that is hierarchical.

CleanShot 2023 07 27 at

Operator: ==

Is parent

Render elements depending on whether the current single page (of any hierarchical post type) has at least 1 child.

View: Designed for use in singular pages or a template that applies to static Pages or any other post type that is hierarchical.

CleanShot 2023 07 27 at

Operator: ==

Language (Polylang)

Render elements depending on whether the current page’s language as set in Polylang matches the one you select in the condition.

CleanShot 2023 08 02 at

Operators: is, is not

Language (TranslatePress)

Render elements depending on the page’s language when using TranslatePress.

translatepress bricks condition

Operators: is, is not

The default value will be the default language set in TranslatePress’ settings.

View: Can be used anywhere.

Language (visitor)

Render elements depending on whether the user’s locale as set in their browser is equal to what is entered in the condition.

View: Can be used anywhere.

CleanShot 2023 07 27 at

The locale code should be entered in the last Value field of the Conditions interface.

The code can be obtained from this page.

You can check your locale by typing navigator.language in your browser’s console and hitting return.

Operators: ==, !=

Language (WPML)

Render elements depending on whether the language of the page being viewed is the one selected in the condition.

View: can be applied on any element sitewide.

(Note that this condition will not appear without the WPML plugin active)

CleanShot 2023 07 31 at

Operators: is, is not

Loop item number

Render elements inside query loops depending on the item number (beginning with 1) in the loop.

CleanShot 2023 08 02 at

By selecting every operator, it is possible output elements every 2nd post for example (you would enter 2 in the Value field in this case).

Sequence pattern (v1.5.7+) – similar to ‘every’ in terms of targeting every nth item, but this option allows you to also choose the starting number (ie the remainder). format n:m

Examples..

  • To show an element in every ‘even’ loop item (2,4,6,8..), you’d set the value to 2:0 (every 2nd post starting with 0)
  • To show an element in every ‘odd’ loop item (1,3,5,7..), you’d set the value to 2:1 (every 2nd post starting with 1)
  • To show an element in 1,4,7,10 items you’d set the value to 3:1 (every 3rd starting with 1)
  • To show an element in 2,5,8,11 items you’d set the value to 3:2 (every 3rd starting with 2)
  • and so on

Operators: ==, !=, >=, <=, >, >=, every, sequence pattern

Page type

Render elements depending on whether the current page being viewed on the frontend is a post or Page or homepage or blog posts index or category archive or several other criteria.

CleanShot 2023 07 28 at

Front page: This is for what is displayed at your site’s main URL. If you set a static page for the front page of your site, this function will return true (when the operator is is) when viewing that page. Otherwise the same as the Posts page a.k.a. Blog posts index.

Posts page (blog): Blog posts index.

Static Page: Any single Page (i.e, a post of the page post type).

Single post: A single post (of the post post type).

Singular: post of any post type.

Single: post of any post type, except attachments and pages.

Archive: Any archive page.

Category archive: Any category archive page.

Tag archive: Any tag archive page.

Search results: Search results pages.

Author archive: Any Author archive page.

Taxonomy archive: Archive page of any custom taxonomy.

404: Any 404 Error / Page Not Found page.

Date archive: Any date archive page.

Note: WooCommerce-specific options will only appear if WooCommerce is active.

WooCommerce: A page which uses WooCommerce templates (cart and checkout are standard pages with shortcodes and thus are not included).

WC Shop: The main WooCommerce Shop page.

WC Product category: Any WooCommerce product category archive page.

WC Product tag: Any WooCommerce product tag archive page.

WC Single product: Any WooCommerce product page.

WC Cart: WooCommerce Cart page.

WC Checkout: WooCommerce Checkout page.

WC Account: WooCommerce Account page.

WC Endpoint: Any WooCommerce Endpoint page.

WC Order Pay … WC Add payment method: Other WooCommerce endpoint pages. Reference.

Operators: is, is not

Post ancestor (v1.4.1+)

Render elements depending on whether the post has an ancestor matching the given ID. Similar to ‘post parent’ but includes searching for grandparent and further up.

Operators: includes, does not include

SCR 20240115 sbpb

Post category

Render elements depending on whether the single post page being viewed on the front end has the selected category assigned to it.

You may read this condition as “Is this post in this category?”.

View: Designed for use in a template that applies to single posts.

CleanShot 2023 07 27 at

Operators: ==, !=

Post comment count

Render elements based on the result of comparing the number of comments with the inputted number.

View: Designed for use in single Post template or templates of other post types that have comments support.

CleanShot 2023 07 27 at

Operators: ==, !=, >=, <=, >, >=

Page parent

Bricks includes a Post parent condition that enables us to conditionally render elements if the current post is a child of another post specified by its ID.

Our condition is similar but with two differences:

  1. It is limited to the page post type i.e., the regular static Pages
  2. It lists titles of all the parent Pages in the Value dropdown – meaning you don’t need to look for the ID and type/paste it in
CleanShot 2023 07 31 at

Operators: is, is not

Post publish date

Render elements depending on whether the current post’s publish date is in the past or today.

View: Single post pages and/or in query loops anywhere.

CleanShot 2023 07 28 at

Operator: is

Post tag

Render elements depending on whether the single post page being viewed on the front end has the selected tag assigned to it.

You may read this condition as “Does the current post have this tag assigned?”.

View: Designed for use in a template that applies to single posts.

CleanShot 2023 07 27 at

Operators: ==, !=

Post type (v1.4.1+)

Render elements depending on if the current viewed post is a specific post type. Useful for when using the template for multiple post types, or inside query loops that may contain multiple post types.

SCR 20240115 sciy

Operators: ==, !=

Published during the last

Render elements on posts on single post pages or in query loops depending on whether the date on which post was published is within the last day or month or week or year.

[Update – will add support for all post types in next update.]

CleanShot 2023 08 01 at

Operators: ==, !=

Tag archive

Render elements depending on whether a tag archive page being viewed on the front end is that of the selected tag.

View: Designed for use in a template that applies to tag archives.

CleanShot 2023 07 27 at

Operators: ==, !=