×

Welcome to TagMyCode

Please login or create account to add a snippet.
0
0
 
0
Language: PHP
Posted by: Eric De Kock
Added: May 1, 2017 10:40 PM
Views: 14
Tags: no tags
  1. <?php if( have_rows('content') ): ?>
  2.  
  3. <?php $j=1; while ( have_rows('content') ) : the_row(); ?>
  4.  
  5. <?php   if( get_row_layout() == 'accordion' ): ?>
  6.  
  7. <?php   if (get_sub_field('heading')) { ?>
  8. <h2 class="title text-center"><?php the_sub_field('heading'); ?></h2>
  9. <?php } ?>
  10.  
  11. <?php if( have_rows('sections') ): ?>
  12.  
  13. <div class="panel-group" id="accordion-<?php echo $j; ?>" role="tablist" aria-multiselectable="true">
  14.  
  15. <?php   $i=1; while ( have_rows('sections') ) : the_row(); ?>
  16.  
  17. <div class="panel panel-default">
  18. <div class="panel-heading" role="tab" id="heading-<?php echo $i; ?>">
  19. <h2 class="panel-title">
  20. <a data-toggle="collapse" data-parent="#accordion-<?php echo $j; ?>" href="#collapse-<?php echo $j; ?>-<?php echo $i; ?>" aria-expanded="true" aria-controls="collapseOne">
  21. <?php the_sub_field('question'); ?>
  22. </a>
  23. </h2>
  24. </div>
  25.  
  26. <div id="collapse-<?php echo $j; ?>-<?php echo $i; ?>" class="panel-collapse collapse <?php if ($i==1) { echo 'in'; } ?>" role="tabpanel" aria-labelledby="heading-<?php echo $i; ?>">
  27. <div class="panel-body">
  28. <?php the_sub_field('answer'); ?>
  29. </div>
  30. </div>
  31.    
  32. </div>
  33. <?php $i++; endwhile; ?>
  34. </div>
  35.  
  36. <?php endif; ?>
  37. <?php endif; ?>
  38.  
  39. <?php $j++; endwhile; ?>
  40.  
  41. <?php else : endif; ?>