Support

Account

Home Forums Add-ons Repeater Field Nested Repeater Bootstrap Tabs Reply To: Nested Repeater Bootstrap Tabs

  • Hi John!
    I got this to work 100%, I had to make a few changes but now works great
    this is the code in case someone needs it,

    
    <div>
        <?php
    
        if( have_rows('menu_sections') ): ?>
            <ul class="nav nav-tabs" id="" role="tablist">
                <?php $i=0; while ( have_rows('menu_sections') ) : the_row(); ?>
                    <?php
                    $string = sanitize_title( get_sub_field('section_title') );
                    ?>
                    <li role="presentation" <?php if ($i==0) { ?>class="active"<?php } ?>  >
                        <a>" aria-controls="<?php echo $string ?>" role="tab" data-toggle="tab"><?php the_sub_field('section_title'); ?></a>
                    </li>
                    <?php $i++; endwhile; ?>
            </ul>
            <div class="tab-content">
                <?php $i=0; while ( have_rows('menu_sections') ) : the_row(); ?>
                    <?php
                    $string = sanitize_title( get_sub_field('section_title') );
                    ?>
                    <div role="tabpanel" class="tab-pane text-left fade <?php if ($i==0) { ?>in active<?php } ?>" id="<?php echo $string; ?>">
                        <?php
                        while (have_rows('section_items')) {
                            the_row();
                            // Display each item as a list
                            ?>
                            <ul>
                                <li class="list-unstyled"><?php the_sub_field('dish_name'); ?></li>
                                <li class="list-unstyled"><?php the_sub_field('dish_description'); ?></li>
                                <li class="list-unstyled">$<?php the_sub_field('dish_price'); ?></li>
                            </ul>
                            <?php
                        } // end while have rows section_items
                        ?>
    
                    </div>
                    <?php $i++; endwhile; ?>
            </div>
        <?php endif; ?>
    </div>
    

    Thanks for all your help.