Can I take the value of a custom field and use true/false checkbox fields to display that value in one location, or another, or both?
<?php if (field_slug_1 == true && get_field(‘text_field_slug_2’)): the_field(‘text_field_slug_2’); ?>
I don’t know if it’s doable or how I would write it.
Yes, you can do that, and you’re coding of it looks correct.
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).