How to display an image from an ACF custom field

[ad_1]

Hello, I am trying to display an image from an ACF custom field but it is not displaying. Here is the code

<?php 
        $featurePosts = new WP_Query(array(
            'category_name' => 'travel-inspiration-feature',
            'posts_per_page' => 1
        ));
        if ($featurePosts->have_posts()) :
            while ($featurePosts->have_posts()) :
                $featurePosts->the_post();
                ?> 
                    <div class="bu-feature-post-container">
                        /* Display feature image from ACF custom field */
                        <?php 
                            $featureImage = get_field('blue-section-feature-img');
                            $size="large";
                            if ( $featureImage ) {
                                echo wp_get_attachment_image( $featureImage, $size );
                            }
                        ?>
                        <img class="bu-img" src="https://projectdmc.org/support/topic/how-to-display-an-image-from-an-acf-custom-field/<?php the_field("blue-section-feature-img'); ?>" alt="">
                        
                        <hr class="bu-yellow-line">
                        <h2><?php the_title(); ?></h2>
                    </div>
                <?php
            endwhile;
        endif;
    ?>

In this code i have tried two different ways to display the image from the field. Any help with this is greatly appreciated. Thank you.

 

This site will teach you how to build a WordPress website for beginners. We will cover everything from installing WordPress to adding pages, posts, and images to your site. You will learn how to customize your site with themes and plugins, as well as how to market your site online.

Buy WordPress Transfer