Home › Forums › General Issues › Show one image or the other Image › Reply To: Show one image or the other Image
Hi @dailyreup
This will show the first image if it exists, otherwise fallback to the secondary image. If none exists nothing will show.
<?php
$header_image = ( get_field('header_banner_image') ? get_field('header_banner_image') : get_field('secondary_header_banner_image') );
if( $header_image) {
?>
<img src="<?php echo $header_image; ?>" alt="" />
<?php } ?>
Is that what you where after?
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.