Home › Forums › Add-ons › Repeater Field › Multiple Bootstrap accordions with repeater field › Reply To: Multiple Bootstrap accordions with repeater field
And here is my code for Bootstrap 4.
I change the IDs name (#accordion) because I want to use multiple accordions on one page.
<?php if( have_rows('_accordion_zeile') ): $accordion++; ?>
<div id="accordion<?php echo $accordion; ?>">
<?php while ( have_rows('_accordion_zeile') ) : the_row(); $collapse++; ?>
<div class="card">
<div class="card-header" id="heading<?php echo $collapse; ?>">
<h5 class="mb-0">
<button class="btn btn-link" data-toggle="collapse" data-target="#collapse<?php echo $collapse; ?>" aria-expanded="true" aria-controls="collapse<?php echo $collapse; ?>">
<?php the_sub_field("_accordion_titel"); ?>
</button>
</h5>
</div>
<div id="collapse<?php echo $collapse; ?>" class="collapse" aria-labelledby="heading<?php echo $collapse; ?>" data-parent="#accordion<?php echo $accordion; ?>">
<div class="card-body">
<?php the_sub_field("_accordion_inhalt"); ?>
</div>
</div>
</div>
<?php endwhile; ?>
</div>
<?php endif; ?>
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
π Weβre excited to announce we've released Composer support for installing ACF PRO.
— Advanced Custom Fields (@wp_acf) January 31, 2023
π #ComposerPHP fans rejoice!
β¨ Please see the release post for all the details and full instructions. https://t.co/ebEfp61nlR
© 2023 Advanced Custom Fields.
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Cookie Policy. If you continue to use this site, you consent to our use of cookies.