• As the title implies no matter what question title i click on it only opens/closes the first tab in the accordion. I know the information is there but hidden behind the unopened tabs because i viewed the page source and can see it there… just cant get any other tabs to work.

    <div class=”container”>
    <div class=”row”>
    <div id=”accordion” role=”tablist” aria-multiselectable=”false” class=”py-4″>

    <?php
    $counter = 0;
    $loop = get_field(‘questions’);
    foreach($loop as $row) : ?>
    <div class=”card card-no-border card-no-shadow”>
    <div class=”card-header” role=”tab” id=”heading<?php echo $counter++ ?>”>
    <h5 class=”mb-0″>
    <a class=”body2 uppercase bold” data-toggle=”collapse” data-parent=”#accordion”
    href=”#collapse<?php the_ID(); ?>”
    aria-expanded=”<?php echo $first; ?>” aria-controls=”collapse<?php the_ID(); ?>”>
    <i class=”fa fa-chevron-right” aria-hidden=”true”></i>
    <span style=’padding-right: 20px;’></span>
    <?php echo $row[‘question_title’]?>

    </h5>
    </div>

    <div id=”collapse<?php the_ID(); ?>” class=”collapse<?php if ($first) {
    echo “show”;
    } ?>” role=”tabpanel”
    aria-labelledby=”heading<?php the_ID(); ?>”>
    <div class=”card-block body2″>

    <?php echo $row[‘answer’] ?>

    </div>
    </div>
    </div>
    <?php endforeach; ?>
    </div>
    </div>
    </div>

  • The topic ‘Bootstrap accordion in WP ACF loop only opening/closing first panel’ is closed to new replies.