This members-only tutorial provides the steps to register a custom condition for Oxygen using which elements on singular pages can be output only if the specified Meta Box group is not empty.
The built-in Dynamic Data condition of Oxygen with Meta Box and is_not_empty operator will not work in this situation.
We shall build a condition in which we get the value of the group field and if not empty, loop through the group field's rows and inside that loop through the sub field IDs, check for the values of the sub fields and do a logical AND check between the resulting array items.
The name of the group field's ID is to be entered in the rightmost input when applying the condition.
The field being empty in this case refers to none of the sub fields being populated.
Ex.:
Step 1
Install and activate Code Snippets plugin.
Go to Snippets > Add New.
Title: [Condition] Meta Box Group Not Empty
Code:
This is a premium members-only content.
To view the rest of the content, please sign up for membership ($47/month or $599 one-time).
Already a member? Log in below or here.