Created
June 10, 2016 20:42
-
-
Save tomfinitely/908d182fc7f010f03962e53407614b40 to your computer and use it in GitHub Desktop.
WordPress Advanced Custom Field (ACF) - Repeater with Conditional Subfields
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//* 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