Support

Account

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. 🙂