25th Aug '22
/
0 comments

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 632 Bricks code tutorials with BricksLabs Pro

Related Tutorials..

Checking if Repeater/Cloneable Meta Fields Are Empty in Bricks

Checking if Repeater/Cloneable Meta Fields Are Empty in Bricks

Creating a condition to ensure that a section only gets output if at least one row of data is filled in.
Categories:
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…
Checking if the current post has been published within the last x days

Checking if the current post has been published within the last x days

Conditionally output an element if the current post has been published in the last x number of days.
Categories:
Pro
Data Attribute-based Conditional Output in Bricks

Data Attribute-based Conditional Output in Bricks

Showing how to prevent rendering any elements that have a specific data attribute set.
Categories:
Pro
Meta Box Group Subfield Text’s Slug as Query Loop Item ID in Bricks

Meta Box Group Subfield Text’s Slug as Query Loop Item ID in Bricks

In the BricksLabs Facebook group a user asks: I have a metaBox custom field called 'section_title' inside a clonable metabox group called 'about_section' How can…
Categories:
Tags:
Output HappyFiles Folders in Metabox Select-Field

Output HappyFiles Folders in Metabox Select-Field

This tutorial is part of a series where I'm gonna show you how to output custom HappyFiles Galleries and Sliders. Part one will cover a…
Categories:
Pro
Meta Box Group’s Number Sub Field Values Sum

Meta Box Group’s Number Sub Field Values Sum

In the Bricks Facebook group a user asked: We can define a custom function that takes a Meta Box group ID, the sub field ID…
Categories:
Tags: