I’m using the code below to create links to content. But what I’m trying to accomplish is that the very first record of link/content to display with the class “active”. So the first record will display <li class="active">
and the first record of the div will have the ‘active’ class as well: <div id="whatever" class="tab-pane fade in active">
.
<div class="tab-content">
<div role="tabpanel" class="tab-pane fade in active" id="features">
<div class="container">
<?php if( have_rows('features') ): ?>
<?php
// vars
$title = get_sub_field('feature-title');
$description = get_sub_field('feature-description');
$linkid = get_sub_field('link_id');
?>
<div class="col-xs-6 left">
<ul class="nav nav-tabs tabs-left">
<?php while( have_rows('features') ): the_row(); ?>
<li><a href="#<?php echo the_sub_field('link_id');?>" data-toggle="tab"><?php the_sub_field('feature-title'); ?></a></li>
<?php endwhile; ?>
</ul>
</div>
<div class="col-xs-6">
<div class="tab-content">
<?php while( have_rows('features') ): the_row(); ?>
<div id="<?php echo the_sub_field('link_id');?>" class="tab-pane fade in"><?php echo the_sub_field('feature-description'); ?></div>
<?php endwhile; ?>
</div>
</div>
<?php endif; ?><!--endif-->