Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save tomfinitely/908d182fc7f010f03962e53407614b40 to your computer and use it in GitHub Desktop.
Save tomfinitely/908d182fc7f010f03962e53407614b40 to your computer and use it in GitHub Desktop.
WordPress Advanced Custom Field (ACF) - Repeater with Conditional Subfields
//* Program Faculty
$faculty = get_field('faculty_listing');
if( have_rows('faculty_listing') ) :
echo '<section class="row" id="faculty"><div class="wrap"><h4>Faculty</h4><div class="faculty">';
while( have_rows('faculty_listing') ): the_row();
// vars
$name = get_sub_field('faculty_name');
$title = get_sub_field('faculty_title');
$url = get_sub_field('faculty_url');
echo '<div class="faculty-member">';
if ( get_sub_field('faculty_name') ) echo '<h5>'. $name .'</h5>';
if ( get_sub_field('faculty_title') ) echo '<h6>'. $title .'</h6>';
if ( get_sub_field('faculty_url') ) echo '<a href="'. $url .'" class="suicon-angle-right read-more">Full Biography</a>';
echo '</div>';
endwhile;
echo '</div></div></section>';
endif;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment