Viewing 4 replies - 1 through 4 (of 4 total)
  • Thread Starter letterafterz

    (@letterafterz)

    My temporary workaround is to edit thumbnailer.php in the theme:

    LINE 201

    /**
     * Get thumbnails when post is displayed
     */
    
    function wp_rp_get_img_tag($src, $alt, $size=null) {
    	if (!$size || !is_array($size)) {
    		$size = array(WP_RP_THUMBNAILS_WIDTH, WP_RP_THUMBNAILS_HEIGHT);
    	}
    	$size_attr = ($size[0] ? ('width="' . $size[0] . '" ') : '');
    	if ($size[1]) {
    		$size_attr .= 'height="' . $size[1] . '" ';
    	}
    
    	/* MY HACK */
    		//get image from ID if it's a number
    		if (is_numeric($src)):
    			$src = wp_get_attachment_image_src( (esc_attr($src)), 'thumbnail' );
    		else:
    			$src[0] = $src;
    		endif;
    
    		return '<img src="'. $src[0] . '" alt="' . esc_attr($alt) . '" '.$size_attr.'/>';
    	/* END HACK */
    }

    Hey, thanks for reaching out & I would love to help you out, but in order to do so we would need a bit more information, if possible.

    Is there a chance you could send us the link to the blog in question, so that we could have a closer look at those images and their ID’s?

    Let us know, we’re eager to help you out! Take care & I’m looking forward to your reply!

    Best,
    Silvo

    Thread Starter letterafterz

    (@letterafterz)

    I’ve resolved the issue now by using image objects in acf instead of image IDs.

    Hey, that’s great news, really glad you found your way around the problem, to honest!

    But please do let me know if something similar happens again or if there’s anything else that I can help you with, since I’ll gladly do it!

    Take care & enjoy your weekend ahead!

    Best,
    Silvo

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Custom posts (ACF) – Can't display thumbnails – getting ID instead of url’ is closed to new replies.