bodiequirk
7/25/2015 - 5:42 AM

ACF Nested Repeater Field to Table for Genesis

ACF Nested Repeater Field to Table for Genesis

<?php

add_action( 'genesis_entry_content', 'rainbow_assemblies_of_ca' );

function rainbow_assemblies_of_ca() {

    if ( have_rows('assemblies_of_ca') ):

        while ( have_rows('assemblies_of_ca') ) : the_row(); ?>

            <h2 class="decade-title"><?php the_sub_field('region_of_ca'); ?></h2>

            <?php if ( have_rows('assembly_info') ): ?>

                <table>

                    <thead>
                        <tr class="assemblies-row">
                            <td>City</td>
                            <td>Address</td>
                            <td>Meeting Times</td>
                            <td>Contact Person</td>
                        </tr>
                    </thead>

                    <?php while ( have_rows('assembly_info') ) : the_row(); ?>

                        <tr>
                            <td><?php the_sub_field('assembly_city'); ?></td>
                            <td><?php the_sub_field('assembly_address'); ?></td>
                            <td><?php the_sub_field('assembly_meeting_times'); ?></td>
                            <td><?php the_sub_field('assembly_contact_person'); ?></td>
                        </tr>

                    <?php endwhile; // end assemblies info ?>

                </table>

            <?php endif; // end assembly_info ?>
        
        <?php endwhile; // end assemblies_of_ca ?>
 
<?php endif; // end assemblies_of_ca

} // End rainbow_assemblies_of_ca();

genesis(); // Initialize Genesis

// End of File