Home › Forums › Add-ons › Flexible Content Field › Post Based On Condition of Field › Reply To: Post Based On Condition of Field
Looks to me like it is:
<article id="blue" <?php post_class(); ?>>
<?php
if( have_rows('text_section') ):
while ( have_rows('text_section') ) : the_row();
$title = get_sub_field('title');
$text = get_sub_field('text');
$texts = get_sub_field('text_copy');
$cols = get_sub_field('columns');
?>
<div class="entry-header">
<h1 class="entry-title"><?php the_sub_field('title'); ?></h1>
</div>
<div class="container">
<?php
if(get_sub_field('columns') == "1") : ?>
<?php the_sub_field('text'); ?>
<?php elseif( get_sub_field('columns') == "2") : ?>
<div class="col-sm-6">
<?php the_sub_field('text'); ?>
</div>
<div class="col-sm-6">
<?php the_sub_field('text_copy'); ?>
</div>
<?php endif;
endwhile;
endif;
?>
</div>
</article>
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!
CPT registration is coming to ACF! We demoed the new feature during the most recent session of ACF Chat Fridays. Check out the summary for the details. https://t.co/k2KQ3WWBAz
— Advanced Custom Fields (@wp_acf) March 7, 2023
© 2023 Advanced Custom Fields.
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 Cookie Policy. If you continue to use this site, you consent to our use of cookies.