I have a number of repeating fields and I want to check each one to see if it is empty, if it is not to display it.
I have included a screen capture of the settings.
This is a repeating field do I need to write a function for this conditional display to work?
If yes can you give me an example of the code please.
Can we clarify the nomenclature here, as people tend to use "repeating field" and "repeatable field group" interchangeably, but they are quite distinct.
A single custom field can be "repeating" inasmuch as it accepts multiple values. For example if you have an image field you might use it to add multiple images to a post. In implementation terms, it just means extra values added with the same meta_key to the wp_postmeta table for a given post.
Repeatable field groups are when you can add multiple values for custom fields to a post, but where the custom fields are related to each other. So if you have a "Contact" repeatable field group with fields for "Name", "Phone", and "Email", each entry for phone and email relate to a particular person.
Those are implemented using post relationships, where a child post is created for each instance of grouped fields, and the custom fields belong to that child post rather than to the original post the fields are added to ("belongs to" in the sense that in wp_postmeta the fields are tied to the child post).
As for conditions, with repeating fields nothing special is required. Before outputting the field you check if it has a value or is empty.
For repeatable field groups, the context to display them would be a View that queries the repeatable field group (the custom post type that are the child posts which has the actual custom field values). That View will iterate over each instance of a group of related fields. Then you can add a condition to check whether for each instance does a particular field have a value to output. In the example from above, for some person, do they have an email address to output? The context is just the current post (the child post holding the custom field values).
It is a custom field that allows more than one value, not a custom field group.
I am using a conditional block with the settings shown in the screen capture sent in the previous enquiry. This results in NOT ( empty( ARRAY([wpv-for-each field="interiors-features" separator=", "]'[types field='interiors-features' output='raw'][/types]'[/wpv-for-each])) )
My issue is the field does not display when it has content or when it does not have content.
If it is a repeating field there is no reason to use the wpv-for-each shortcode to iterate over each field value.
Is that what is shown if you switch to the Advanced Editor to see the details of the condition?
I wouldn't expect what's shown in your original screenshot to produce that condition code, but if that is the case please let us know and we can do some testing of a similar scenario locally.
The condition itself should look something like this: