Home Forums General Issues ACF in attachment-single.php Reply To: ACF in attachment-single.php

  • OK, it’s an error in the php logic. In your code you are saying IF chapo, display ‘chapo’ and also the_content(). You need to use ELSE to display one or another, such as:

    <?php $field = get_field('chapo');?>
    <?php if( !empty($field) ) { ?>
    <?php echo $field; ?>
    <?php } else { ?>
    <?php the_content(); ?>
    <?php } ?>

    I am also adding a condition that says: if ‘chapo’ is not empty. Which is helpful most of the time.