Meta Box Settings Page Custom Field Conditional in Bricks

This is the equivalent of ACF Options Page Custom Field Conditional in Bricks tutorial for Meta Box.

Refer to the previous Meta Box Settings Fields in Bricks tutorial on how to pull and output custom fields from a Meta Box Settings Page incl. those from inside a group-type of field.

This Pro tutorial provides the code for outputting an element (phone number in the header whose value can be set in the Settings page) that has a specific class (header__phone) only when a particular custom field (phone) is populated on the Meta Box Settings page i.e., not empty.

To ensure that the Block/Div/Basic Text element having the phone number is rendered only when the phone field on the Settings page is populated, add the following in child theme's functions.php or a code snippets plugin:

This is a BricksLabs Pro tutorial.

For full access login below or create your BricksLabs Pro account

Get access to all 524 Bricks code tutorials with BricksLabs Pro

Related Tutorials..

Pro
Meta Box Settings Fields in Bricks

Meta Box Settings Fields in Bricks

This Pro tutorial is the equivalent of our earlier ACF Options Fields in Bricks article but when using Meta Box. While retrieving the values of…
Categories:
Tags:
Pro
MB Favorite Posts in Bricks

MB Favorite Posts in Bricks

This tutorial explores using MB Favorite Posts in Bricks, including outputting the list of favorites via a query loop.
Categories:
Conditionally Outputting Elements Only for Posts That Have a Specific Taxonomy Term

Conditionally Outputting Elements Only for Posts That Have a Specific Taxonomy Term

Using the core WordPress has_term() function for checking if the current post has a specific term of a given taxonomy.
Categories:
Pro
Querying Posts by Date/Datetime Custom Fields in Bricks

Querying Posts by Date/Datetime Custom Fields in Bricks

This Pro tutorial shows how to configure ACF and Meta Box to query posts in Bricks by custom field(s) of the type Date/Date Time Picker…
Categories:
Tags:
Pro
Restrict Content Pro in Bricks

Restrict Content Pro in Bricks

This Pro tutorial provides the steps to restrict Pages and individual elements like Sections in Bricks depending on whether the current user has any active…
Pro
Ordering Meta Box group rows by a sub field in Bricks

Ordering Meta Box group rows by a sub field in Bricks

In the BricksLabs Facebook group a user asks: Any idea how to set the sort order of a cloneable group in the query? In this…
Pro
Dynamic Date in Bricks Countdown Element

Dynamic Date in Bricks Countdown Element

As of Bricks 1.9.7.1, the built-in Countdown element's Date control does not support dynamic data. That is, it is not possible to set this date…