Support

Account

Home Forums ACF PRO Can I use compound if statements to show field content in different places? Reply To: Can I use compound if statements to show field content in different places?

  • Ok, thanks for your reply and I can’t believe I’m starting to get some of this. HOWEVER, what I put into the post-template doesn’t work (and am happy that it doesn’t break the page).

    Here’s what I inserted…two instance, neither of which work to NOT SHOW when the true/false field is unchecked.

    <?php // profession drop down with multiple selection option - vars	
    
    	$profession = get_field('profession');
    
    // check
    if( display_profession_on_public_listing == true && $profession ): ?>
    <div class="professions"><?php echo implode(', ', $profession); ?></div>
    <?php endif; ?>
    <?php if( display_profession_on_public_listing == true && get_field('alt_profession') ): ?>
    	<div class="otherProfession"><?php the_field('alt_profession'); ?></div>
    <?php endif; ?>	

    First of these is a drop-down and the second one is a text-field (single line).