Continuing on from this post: Https://theme.co/apex/forum/t/accordion-using-acf-repeater-fields/62703/2?u=instadesign
…So I shouldn’t need to worry about the js, great. I tried using the shortcodes using do_shortcode() but got nowhere…
This is the code I’ve got, which is tantalisingly close:
<?php if( have_rows('statements_questions_answers') ): ?>
<div id="q-and-a-accordion" class="x-accordion">
<?php $i = 0; ; while( have_rows('statements_questions_answers') ): the_row();
$title = get_sub_field('statement_question');
$content = get_sub_field('answer');
$i++; $tCount = $i;
?>
<div class="x-accordion-group">
<div id="heading<php echo $tCount; ?>" class="x-accordion-heading">
<a class="x-accordion-toggle" role="tab" data-x-toggle="collapse<?php echo $tCount; ?>" data-target="#collapse<?php echo $tCount; ?>" data-x-toggleable="<php echo $tCount; ?>" aria-expanded="false" aria-controls="collapse<php echo $tCount; ?>"><?php echo $title; ?>
</a>
</div>
<div id="collapse<php echo $tCount; ?>" class="x-accordion-body" role="tabpanel" data-x-toggle-collapse="1" data-x-toggleable="<php echo $tCount; ?>" aria-labelledby="collapse<php echo $tCount; ?>" style=""><div class="x-accordion-inner"><?php the_sub_field('answer'); ?>
</div>
</div>
<?php endwhile; ?>
</div>
<?php endif; ?>
That is displaying my accordion but the accordion groups are nested rather than sequential and not interactive… I know I must be missing something relatively simple but it’s evading me!