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 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 Privacy Policy. If you continue to use this site, you consent to our use of cookies.