Support

Account

Home Forums ACF PRO Image field not showing an image!

Unread

Image field not showing an image!

    • gumby

    • February 6, 2019 at 9:10 pm

    Hi guys,

    I’m sure this is something really obvious or silly, but I’m hoping someone can help as I’m hitting a brick wall.

    I have set up an image field in a flexible content layout. I want it to show the “banner” sized image as set in WordPress (this size has been set in the functions file and is working when uploading images).

    When I use the below code – no matter whether I choose array, ID or URL – it only shows the text of the selected option, but no image. I’d like to know how to get the code to show an image for me!

    <?php elseif( get_row_layout() == 'intro-image-block' ): ?>
    
    <div class="intro-image">
    	<?php $image = the_sub_field('intro-image');
    		  $size = 'banner';
    
    		  if( $image ) { echo wp_get_attachment_image( $image, $size ); } ?>
    </div>

    Thanks for any help you can provide.

Viewing 1 post (of 1 total)

You must be logged in to reply to this topic.

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