Last active
March 22, 2018 16:46
-
-
Save nfsarmento/12abda3c75b0c4203be7c5deaf71762e to your computer and use it in GitHub Desktop.
bootstrap 4 collapse accordion with ACF repeater
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 if( have_rows('collapse') ): ?> | |
<div id="accordion" role="tablist"> | |
<?php $i=1; while ( have_rows('collapse') ) : the_row(); ?> | |
<div class="card"> | |
<div class="card-header" role="tab" id="heading-<?php echo $i; ?>"> | |
<h5 class="mb-0"> | |
<a data-toggle="collapse" href="#collapse-<?php echo $i; ?>" aria-expanded="true" aria-controls="collapseOne"> | |
<?php the_sub_field('title'); ?> | |
</a> | |
</h5> | |
</div> | |
<div id="collapse-<?php echo $i; ?>" class="collapse <?php if ($i==1) { echo 'show'; } ?>" role="tabpanel" data-parent="#accordion" aria-labelledby="heading-<?php echo $i; ?>"> | |
<div class="card-body"> | |
<?php the_sub_field('body'); ?> | |
</div> | |
</div> | |
</div> | |
<?php $i++; endwhile; ?> | |
</div> | |
<?php endif; ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment