Support

Account

Home Forums Add-ons Flexible Content Field Post Based On Condition of Field Reply To: Post Based On Condition of Field

  • This seems to work, but it seem rather redundant:

    <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="container">
    					
                <?php
    						if(get_sub_field('columns') == "1") : ?>
    						
                                <div class="entry-header">
                                    <h1 class="entry-title"><?php the_sub_field('title'); ?></h1>
                                </div>
                                
                                <?php the_sub_field('text'); ?>
                                
                                <?php elseif( get_sub_field('columns') == "2") : ?>
                                                
                                <div class="entry-header">
                                    <h1 class="entry-title"><?php the_sub_field('title'); ?></h1>
                                </div>
                                
                              <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>