Support

Account

Home Forums General Issues Conditionally Show Content Based on 'Choice' Reply To: Conditionally Show Content Based on 'Choice'

  • Sorry about that; I think even I was confused on what I wanted to do…

    The code below gave me what I wanted; I’m always open to tips on optimizing it further.

    <?php if(get_field('choose_layout') == "1col")
    { ?>
       	<p><?php the_field('single_column'); ?></p>
    <?php } elseif (get_field('choose_layout') == "2col")
    { ?>
    	<p><?php the_field('two_columns_left'); ?></p>
    	<p><?php the_field('two_columns_right'); ?></p>
    <?php } elseif (get_field('choose_layout') == "3col")
    { ?>
    	<p><?php the_field('three_columns_left'); ?></p>
    	<p><?php the_field('three_columns_middle'); ?></p>
    	<p><?php the_field('three_columns_right'); ?></p>
    <?php } ?>