How to output a ACF Repeater sub field only if it has a value using Oxygen’s Dynamic Data condition
In the WPDevDesign Facebook group, a user asks:
What I’m trying to accomplish is very simple: I made a repeater for team members. The block includes a text field for the bio but this should only show if there is content coming from dynamic data: repeater field => field => bio. The text field has a margin of 20px and underneath there is link-wrapper to the email. So if there is no content for the bio, the text field shouldn’t show up at all to avoid the extra margin spacing.
So my question is: how should I set the conditional to achieve this?
This tutorial for Oxygen provides the steps to output a Advanced Custom Fields’ Repeater-type of field’s sub field value only if that (or any other – if you want) sub field is populated.
Step 1
In the Oxygen editor select your Repeater component and within that, your sub field (in this example, “Bio”).
Step 2
Click on Condition Settings icon and then Set Conditions button.
Step 3
Select Dynamic Data condition.
Step 4
Click on Repeater Field under Post.
Step 5
Select your sub field and click INSERT.
Step 6
Select is_not_blank as the operator.
and that’s it!
Now the custom field will only get output on the frontend if the selected field has a value.