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).
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!
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 Privacy Policy. If you continue to use this site, you consent to our use of cookies.