madeinthearcade
2/23/2017 - 10:20 AM

Create a accordion

Create a accordion

<?php $a = 1; 
	if ( have_rows('free_1:1_business_advice') ) : ?>

	<h3>Free 1:1 Business Advice</h3>
	<div class="panel-group" id="business-advice-<?php echo $a; ?>" role="tablist" aria-multiselectable="true">
		<?php $b = 1;
			while ( have_rows('free_1:1_business_advice') ) : the_row();
				$supportTitle	=	get_sub_field('support_title');
			?>
			<div class="panel panel-default">
				<div class="panel-heading" role="tab">
					<h4 class="panel-title">
						<a role="button" data-toggle="collapse" class="collapsed" data-parent="#business-advice-<?php echo $a; ?>" href="#business-advice-collapse-<?php echo $a; ?>-<?php echo $b; ?>" aria-expanded="false" aria-controls="collapse-<?php echo $a; ?>-<?php echo $b; ?>">
							<?php echo $supportTitle; ?>
						</a>
					</h4>
				</div>
				<div id="business-advice-collapse-<?php echo $a; ?>-<?php echo $b; ?>" class="panel-collapse collapse <?php if ($b==1) ?>" role="tabpanel" aria-labelledby="heading-<?php echo $b; ?>">
					<div class="panel-body">
						<?php if ( have_rows('content') ) : while ( have_rows('content') ) : the_row();
							$details			=	get_sub_field('details');
							$provider		=	get_sub_field('provider');
							$resourceLink	=	get_sub_field('resource_link');
						?>
						<div class="row is-table-row">
							<div class="col-md-3">
								<a href="<?php echo $resourceLink; ?>">
									<img src="<?php echo $provider['url']; ?>" alt="<?php echo $provider['alt']; ?>">
								</a>
							</div>
							<div class="col-md-9">
								<?php echo $details; ?>
							</div>
						</div>
						<?php endwhile; endif; ?>
					</div>
				</div>
			</div>
		<?php $b++; endwhile; ?>
	</div>

<?php $a++; endif; //if have rows ?>