I have some nested repeater fields and I can't seem to get them to work in my twig files. How I have it now(not working) is:
{% for item_outer in post.get_field('outer') %}
{{item_outer.title}}
{% for item_inner in item_outer.get_field('inner') %}
{{item_inner.title}}
{% endfor %}
{% endfor %}
Am I missing something obvious?
Here's a link of them working with PHP, but i'd rather not have to handle these in my controller. http://www.advancedcustomfields.com/resources/tutorials/working-with-nested-repeaters/
@garrettboatman once ACF processes the contents of a field (the outer get_field) everything inside should be appropriately parsed (so no need to do the inner get_field. This should give you what you need:
{% for item_outer in post.get_field('outer') %}
{{item_outer.title}}
{% for item_inner in item_outer.inner %}
{{item_inner.title}}
{% endfor %}
{% endfor %}
Works like a charm. Thanks so much, Jared!
:thumbsup:
Can someone can help me with this? I am trying to access a repeater inside a repeater inside a repeater
{% for item in post.get_field('data_set') %}
<p>{{ item.data_set_description }}</p> // this renders fine
{% for item_outer in post.get_field('data_set_files') %}
{% for item_inner in item_outer.data_set_file_url %}
{{ item_inner }}
{% endfor %}
{% endfor %}
{% endfor %}

{{ item_inner }} does not display.
I have also tried something like this with no luck
{% for item_outer in post.get_field('data_set') %}
{{ item_outer.data_set_description }} // this is displayed just fine
{% for item_inner in item_outer.data_set_files %}
{% for item_inner_inner in item_inner.data_set_file_url %}
{{ item_inner_inner }}
{% endfor %}
{% endfor %}
{% endfor %}
Any suggestions?
Thanks
Can you try this please? Or something of this variation will work
{% for set in post.get_field('data_set') %}
<p>{{ set.data_set_description }}</p> // this renders fine
{% for files in set.data_set_files %}
{% for file in files.data_set_file %}
{{ file }}
{% endfor %}
{% endfor %}
{% endfor %}
Most helpful comment
@garrettboatman once ACF processes the contents of a field (the outer
get_field) everything inside should be appropriately parsed (so no need to do the innerget_field. This should give you what you need: