Created
February 16, 2017 11:48
-
-
Save mikeoberdick/b8e0d94f7f54d2d72a0dcac71dce9086 to your computer and use it in GitHub Desktop.
Snippet for adding new bootstrap rows in the loop
This file contains 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
<?php | |
// check if the repeater field has rows of data | |
if( have_rows('staff_member') ): | |
$i = 0; | |
// loop through the rows of data | |
while ( have_rows('staff_member') ) : the_row(); ?> | |
<?php | |
if($i % 4 == 0) { ?> | |
<div class="row d-flex"> | |
<?php | |
} | |
?> | |
<div class = "col-md-3 mb-4"> | |
<img class = "staff_headshot mb-3" src = "<?php the_sub_field('headshot'); ?>"> | |
<h3 class = "staff_name"><?php the_sub_field('name'); ?></h3> | |
<p class = "staff_bio"><?php the_sub_field('bio'); ?></p> | |
<a class = "staff_email" href = "mailto:<?php the_sub_field('e-mail_address'); ?>"><i class="fa fa-envelope" aria-hidden="true"></i><?php the_sub_field('e-mail_address'); ?></a> | |
<p class = "staff_phone"><i class="fa fa-phone" aria-hidden="true"></i><?php the_sub_field('phone_number'); ?></p> | |
</div> | |
<?php | |
$i++; | |
if($i != 0 && $i % 4 == 0) { ?> | |
</div><!-- end of row --> | |
<?php | |
} | |
endwhile; | |
else : | |
// no rows found | |
endif; | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment