
I’m trying to create tabs with content and that content will have different layouts based on a value in a checkbox field called ‘extras’ in my subfields. I’m new to ACF and not sure the best way to tackle this. I have a screenshot of the way my ACF’s are created.



Here is my code:
<div class="tab-content random-number active">
<?php
if( have_rows('tab_content') ):
$posts = get_posts(array(
'numberposts' => -1,
'post_type' => 'tab_content',
'meta_key' => 'extras',
'meta_value' => 'center_rule'
));
while( have_rows('tab_content') ): the_row();
if( have_rows('extras') ):
while( have_rows('extras') ): the_row(); ?>
<div class="center_rule">
<div class="row">
<div class="twelve columns">
<h1><?php echo the_sub_field('title'); ?></h1>
</div>
</div>
<div class="row">
<div class="six columns left-col">
<?php echo the_sub_field('column-1'); ?>
</div>
<div class="six columns right-col">
<?php echo the_sub_field('column-2'); ?>
</div>
</div>
</div>
<?php endwhile; ?>
<?php endif; ?>
<?php endwhile; ?>
<?php endif; ?>