User Role Condition in Bricks

User Role Condition in Bricks

This Pro tutorial provides the steps to conditionally output elements depending on the currently logged-in user's role.

Step 1

Create a section Template having the content you wish to output for users having a specific role.

Sample name of a Template for author user role: Author User Role Content

Edit and build it with Bricks.

Step 2

Add the following in your child theme's functions.php:

This is a BricksLabs Pro tutorial.

For full access login below or create your BricksLabs Pro account

Get access to all 525 Bricks code tutorials with BricksLabs Pro

Related Tutorials..

Pro
At Least 1 Search Result Condition in Bricks

At Least 1 Search Result Condition in Bricks

Registering a custom condition to render elements depending on whether there is at least one search result.
Categories:
Pro
Month and Day Condition in Bricks

Month and Day Condition in Bricks

This Pro tutorial shows how we can define a custom function that takes in a month in the three-letter format (like Dec) and a day…
Categories:
Pro
Conditional CSS Classes based on Bricks Query Count

Conditional CSS Classes based on Bricks Query Count

In a Bricks project I am currently working on, there are nested query loops - team members inside departments on a Page. Each team member…
Pro
City-based and Country-based Conditional Output in Bricks

City-based and Country-based Conditional Output in Bricks

This Pro tutorial provides the steps to render a Bricks element only if the visitor is from the specified country or city. Note: Caching may…
Categories:
Pro
Check If The Latest Post Was Published in The Last X Minutes

Check If The Latest Post Was Published in The Last X Minutes

In this Pro tutorial we shall define a custom function that takes in the number of minutes as an argument and returns true if there…
Categories:
Conditions in Bricks Builder

Conditions in Bricks Builder

The current version of Bricks does not have a built-in Conditions feature but that does not mean we can't set them up manually with custom…
Categories:
Create A Customizable AJAX Add To Cart Button In Bricks Builder

Create A Customizable AJAX Add To Cart Button In Bricks Builder

In Bricks, you can simply create an Add To Cart button from a dynamic data / function {woo_add_to_cart}. This button supports AJAX as well if…