G
G
Grione2021-07-02 15:48:25
WordPress
Grione, 2021-07-02 15:48:25

How to use repeater inside repeater -- group in Acf wordpress?

I'm using the pro version of ACF.
Here's the structure:
Ways (Repeater)
-Way (Group)
--list_way (Repeater)
--- Items (text)

And now it's impossible to display the last repeater with text.

The code is like this:

<?php
      if( have_rows('ways', 'option') ): ?>
      <ul class="way-list">	
        <?php while( have_rows('ways', 'option') ) : the_row();
        $way = get_sub_field('way', 'option'); ?>
        <li class="way-item">
          <?php
            $rows = $way['list_way'];	
            if( have_rows($rows) ) : ?>
          <ul class="way-item__list">
            <?php while(have_rows($rows) ): the_row(); ?>
            <li><?php echo the_sub_field('items')?></li>
            <?php endwhile; ?>
          </ul>
          <?php endif; ?>
        </li>
        <?php endwhile; ?>
      </ul>
      <?php endif; ?>

So it gives an error
Illegal offset type in isset or empty in ...

Moreover, if you print print_r($rows)
Array ( [0] => Array ( [items] => Tweak your teams on demand ) [1] => Array ( [items] => Optimize development costs ) [2] => Array ( [items] => Choose your cooperation model ) )

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question