Support

Account

Home Forums Add-ons Repeater Field Display tables 1/2 or 1/3 screen using repeater and get_row_index Reply To: Display tables 1/2 or 1/3 screen using repeater and get_row_index

  • Thanks a lot, I’ve already did it this way, and it works

    <div class="row">
                    <?php if(have_rows('table_forms')): ?>
                        <?php $numrows = count( get_field( 'table_forms' ) ); ?>
                        <?php while ( have_rows('table_forms') ) : the_row(); ?>
                            <?php if($numrows <3) {$counttables = 6;} else {$counttables = 4;} ?>
                            <div class="col-md-<?php echo $counttables; ?>">
                            <div class="main-table">
                                <h3><?php the_sub_field('table_forms_name'); ?></h3>
                                <table class="table main-table-slyle">
                                    <tbody>
                                    <tr>
                                        <td class="main-table-td"><h3>Длительность</h3></td>
                                        <td><?php the_sub_field('table_forms_dlit'); ?></td>
                                    </tr>
                                    <tr>
                                        <td class="main-table-td"><h3>Количество часов</h3></td>
                                        <td><?php the_sub_field('table_forms_kol'); ?></td>
                                    </tr>
                                    <tr>
                                        <td class="main-table-td"><h3>Уровень</h3></td>
                                        <td>
                                            <?php the_sub_field('table_forms_urov'); ?>
                                        </td>
                                    </tr>
                                    </tbody>
                                </table>
                            </div>
                            </div>
    
                        <?php endwhile;?>
    
                    <?php
                    else :
                        // no rows found
                    endif;
                    ?>
            </div>