ben-g
7/20/2016 - 2:05 PM

get_field()

get_field()

//Only show field content when there is content to show.

<?php if(get_field('programs_of_study')): ?> /*Checks if field name exists and has content.  Only shows if there is content. */
     
     <div class="programs-of-study">
                                <h2>Program of Study</h2>
                                <?php the_field( 'programs_of_study' ); ?>
                                <?php if(get_field('programs_of_study_list')): ?>
                                <table>
                                    <tbody>
                                        <tr>
                                            <td><strong>Course Type</strong></td>
                                            <td><strong>Credits</strong></td>
                                        </tr>
                                        <?php while(the_repeater_field('programs_of_study_list')): ?>
                                        <tr>
                                            <td><?php the_sub_field('course_type'); ?></td>
                                            <td><?php the_sub_field('credits'); ?></td>
                                        </tr>
                                        <?php endwhile; ?>
                                    </tbody>
                                </table>
                                <?php endif; ?>
                            </div>
                            
  <?php endif; ?> /*End of main get_field() check.