vladzvezdin2018-09-20 11:22:43
vladzvezdin, 2018-09-20 11:22:43

Advanced Custom Fields Display nested groups and fields in them?

I can't figure out the ACF plugin. I have created a Field Group "Main Page". I added the "Slides" group to it. In the "Slides" group, I created subgroups of four slides, which have their own nested fields with texts, headings, etc.
How can I display the titles of at least one slide? Can't understand
<?php the_field('first-title'); ?> does not display the title of the first slide

Answer the question

In order to leave comments, you need to log in

1 answer(s)
Igor Vorotnev, 2018-09-20

Everything is in the documentation , if you read carefully. Namely: the Group field returns an array in the format Field name => Field Value. In the case of nested groups, there will be 2 levels of nesting. Do var_dump( get_field( 'index-slides' ) ); to see what's in the returned array.
According to the link in the dock, there is how to build a cycle correctly. The specificity of this field is that values ​​are stored in the form group-name_field-name, so direct access by field-name (first-title) is not possible.
RTFM in general.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question