Forked from omurphy27/Bootstrap Tabs used with Advanced Custom Fields ACF PHP JS HTML.php
Created
May 23, 2019 15:40
-
-
Save wisnust/dad2a6a5e469ded7a7888a7e34434c89 to your computer and use it in GitHub Desktop.
Bootstrap Tabs used with Advanced Custom Fields ACF PHP JS HTML
This file contains hidden or 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
<?php if( have_rows('tabs') ): ?> | |
<ul class="nav nav-tabs" id="myTab" role="tablist"> | |
<?php $i=0; while ( have_rows('tabs') ) : the_row(); ?> | |
<?php | |
$string = sanitize_title( get_sub_field('tab_title') ); | |
?> | |
<li role="presentation" <?php if ($i==0) { ?>class="active"<?php } ?> > | |
<a href="#<?php echo $string ?>" aria-controls="<?php echo $string ?>" role="tab" data-toggle="tab"><?php the_sub_field('tab_title'); ?></a> | |
</li> | |
<?php $i++; endwhile; ?> | |
</ul> | |
<div class="tab-content"> | |
<?php $i=0; while ( have_rows('tabs') ) : the_row(); ?> | |
<?php | |
$string = sanitize_title( get_sub_field('tab_title') ); | |
?> | |
<div role="tabpanel" class="tab-pane text-center fade <?php if ($i==0) { ?>in active<?php } ?>" id="<?php echo $string; ?>"> | |
<h2><?php the_sub_field('tab_title'); ?></h2> | |
<?php the_sub_field('tab_text'); ?> | |
</div> | |
<?php $i++; endwhile; ?> | |
</div> | |
<?php endif; ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment