Home Forums General Issues How to get image from second field group


How to get image from second field group

  • Hello! I have two field group (1 and 2 on image). 1 – Homepage, 2 – Post type
    In second field i have content, which i can get from by this command:
    esc_html( $featured_post->post_title )
    but I can’t get image (neither in array, url, id form) from this field group.
    I am noob in wordpress and especialy in ACF, although have programming background.
    Please, if anyone can help, I would be very appreciate it.

  • Please can you share your code? Is this on a single post or within a loop?

    Assuming it’s set to array, your code should look like:

    $image = get_field('review_icon');
    if( !empty( $image ) ): ?>
        <img src="<?php echo esc_url($image['url']); ?>" alt="<?php echo esc_attr($image['alt']); ?>" />
    <?php endif; ?>
Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.