Created
May 24, 2017 21:07
-
-
Save justiny/f24eb15fffc49f2db0942913dd037029 to your computer and use it in GitHub Desktop.
Simple Accordion for Bootstrap 4 + Advanced Custom Fields
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div id="accordion" role="tablist" aria-multiselectable="true"> | |
<?php if( have_rows('service_accordion', 'options') ): ?> | |
<?php $i=0; while ( have_rows('service_accordion', 'options') ) : the_row(); ?> | |
<?php $string = sanitize_title( get_sub_field('service_title', 'options') ); | |
$service_content = get_sub_field('service_content', 'options'); ?> | |
<div class="card"> | |
<div class="card-header" role="tab" id="headingTwo"> | |
<h5 class="mb-0"> | |
<a class="collapsed" data-toggle="collapse" data-parent="#accordion" href="#<?php echo $string ?>" aria-expanded="false" aria-controls="<?php echo $string ?>"> | |
<?php the_sub_field('service_title', 'options'); ?> | |
</a> | |
</h5> | |
</div> | |
<div id="<?php echo $string; ?>" class="collapse" role="tabpanel" aria-labelledby="<?php echo $string; ?>"> | |
<div class="card-block"> | |
<?php echo $service_content; ?> | |
</div> | |
</div> | |
</div> | |
<?php $i++; endwhile; ?> | |
<?php endif; ?> | |
</div> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Does this require setting up an ACF field as an "accordion" type or "repeater" type?