Related Posts by Zemanta
[resolved] Custom posts (ACF) - Can't display thumbnails - getting ID instead of url (5 posts)

  1. letterafterz
    Posted 2 years ago #

    Hey guys,

    Great plugin, but I'm having an issue. Using a custom field as set using the ACF plugin - http://www.advancedcustomfields.com/

    It's pulling images up as their image ID instead of URLs and I can't seem to fix it short of hacking the plugin code (not ideal).

    Is there an option to deal with custom fields which are storing the image ID? (I assume that's the issue).

    Output is like this:

    <img src="726" alt="blah blah" width="150" height="150">


  2. letterafterz
    Posted 2 years ago #

    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_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' );
    			$src[0] = $src;
    		return '<img src="'. $src[0] . '" alt="' . esc_attr($alt) . '" '.$size_attr.'/>';
    	/* END HACK */
  3. silvoslaf
    Plugin Author

    Posted 2 years ago #

    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!


  4. letterafterz
    Posted 2 years ago #

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

  5. silvoslaf
    Plugin Author

    Posted 2 years ago #

    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!


Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Related Posts by Zemanta
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic


No tags yet.