Support

Account

Home Forums Add-ons Repeater Field Repeater usage in version 4.x.x Reply To: Repeater usage in version 4.x.x

  • Thanks @john i really appreciate that!

    I am still having trouble getting it to work. I first tried a few of the code examples from that link:

      <?php
                $rows = get_field('product_categories_icons');
                if($rows)
                {
                    echo '<ul>';
    
                    foreach($rows as $row)
                    {
                    echo '<li>sub_field_1 = ' . $row['name'] . ', sub_field_2 = ' . $row['link'] .', etc</li>';
                    }
    
                    echo '</ul>';
                }
                ?>
    
                <?php if(get_field('product_categories_icons')): ?>
                    <ul>
                    <?php while(has_sub_field('product_categories_icons')): ?>
                        <li>sub_field_1 = <?php the_sub_field('name'); ?>, sub_field_2 = <?php the_sub_field('icon'); ?>, etc</li>
                    <?php endwhile; ?>
                    </ul>
                <?php endif; ?>

    Neither of which shows anything on the page. The site is on WPE and i have been clearing the cache with every try.

    Also i do not at the moment have access to the database which would be helpful for me just to confirm what’s coming from where (since ACF is implemented in both places like i mentioned.)

    So i am looking at other pages’ ACF code and am trying to emulating that. I have added this new field i am trying to display to the acf-register-field-groups.php as there are fields that only exist there, not in the GUI ACF, that are working and on pages.

    I am spending hours on this which is crazy, but there’s still something i am not doing right or seeing.

    Lastly i tried this:

    
    <?php if(get_field('product_categories_icons')) : ?>
                    <?php echo '<h1>true</h1>'; ?> 
                    <?php while(has_sub_field('product_categories_icons')): ?>
                        <li>icon = <?php echo get_sub_field('icon'); ?>
                        name = <?php echo get_sub_field('name'); ?></li>
                        <li>icon = <?php echo the_field('icon'); ?>
                        name = <?php echo the_field('name'); ?></li> 
                        <li>name = <?php echo the_sub_field('name'); ?>
                        icon = <?php echo the_sub_field('icon'); ?></li>
                    <?php endwhile; ?>
       <?php endif; ?>

    And since <?php echo '<h1>true</h1>'; ?> doesn’t print under the if something higher up is restricting this field’s display.

    If you have any ideas i’m all ears.

    Thanks!