Home › Forums › General Issues › Condition for acf and the_post() content › Reply To: Condition for acf and the_post() content
Hi you could do something like this:
<?php if( get_field('field_one') || get_field('field_two') ) { ?>
<?php the_field('field_one'); ?> <?php the_field('field_two'); // Display the fields not the content ?>
<?php } else { ?>
<?php the_content(); ?>
<?php } ?>
So we check to see if any fields exist and if they do we display them, if not we display the post’s content.
I hope that helps!
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.