• Resolved davidcarrano

    (@davidcarrano)


    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="<?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.

Viewing 1 replies (of 1 total)
  • Plugin Support ACF Support

    (@acfsupport)

    Hi there!

    ACF Support Team here. This forum is generally used by ACF users to help each other out.

    However, we would love to continue investigating and troubleshooting this issue, please can you create a ticket using our ?support form and we can look into it further.

Viewing 1 replies (of 1 total)
  • The topic ‘How to display an image from an ACF custom field’ is closed to new replies.