Home › Forums › ACF PRO › Problems with Select field and get_sub_field('columns') › Reply To: Problems with Select field and get_sub_field('columns')
I fixed it. For anyone else struggling, ths worked for me:
<?php
if( have_rows('text_area') ) :
while ( have_rows('text_area') ) : the_row();
if( get_row_layout() == 'text' ) :
if(get_sub_field('columns') == "1") : ?>
<div>
<?php the_sub_field('first_column_text') ;?>
</div>
<?php elseif(get_sub_field('columns') == "2") : ?>
<div>
<?php the_sub_field('first_column_text'); ?>
<?php the_sub_field('second_column_text'); ?>
</div>
<?php endif;
endif; //get_row_layout
endwhile; //have_rows
endif; //have_rows
?>
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.