Home › Forums › Add-ons › Repeater Field › List All Sub Fields in a Repeater or Flex Field › Reply To: List All Sub Fields in a Repeater or Flex Field
I tried this and just get the word “Array” instead of my list of [repeated] fields for that Post.
Here’s what worked: using the examples found on this page:
http://www.advancedcustomfields.com/resources/repeater/
I created the following code that checks my repeater field for that Post and if it finds rows, list (wrapped in li tags) each row. I only have one field (subfield) per row, so my example is very basic….if your rows contain tabular-style data with more than one field per row, you’ll have to more closely follow the examples from that page.
Here’s my code that works:
<?php if( have_rows('room_types') ): ?>
<ul>
<?php while( have_rows('room_types') ): the_row(); ?>
<li><?php the_sub_field('room_type'); ?></li>
<?php endwhile; ?>
</ul>
<?php endif; ?>
Hopefully this will help. 🙂
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.