Forked from omurphy27/bootstrap collapse accordion with ACF repeater loop.php
Last active
March 4, 2021 19:02
-
-
Save lincolnlemos/95d8c7288261234202bcb0881cc9d97c to your computer and use it in GitHub Desktop.
bootstrap collapse accordion with ACF repeater loop.php
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