Support

Account

Home Forums ACF PRO Shortcode image problem

Helping

Shortcode image problem

  • Hi, I need to shortcode an image. But I can not make it appear according to my var_dump it outputs to me as “int”. I would like to show my image in ID. Can you help me? Here is my code:

    
    function contrib_image($atts){
        ob_start();
            $pics_contrib = get_field('photoUser');
            var_dump($pics_contrib);
                if ($pics_contrib){
                    echo wp_get_attachment_image('$pics_contrib', 'full');
                }
        $short_list = ob_get_clean();
        return $short_list;  
    }
    add_shortcode('img_contrib', 'contrib_image');
  • Remove the quotes here

    
    echo wp_get_attachment_image($pics_contrib, 'full');
    
Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.