Support » Plugin: WordPress Related Posts » [Plugin: WordPress Related Posts] Support Intext Images

  • Resolved saschanord

    (@saschanord)


    Hi,

    after installation I made an update to your code.
    If no thumbnail is attached or defined it tries to parse an image included using an “img” tag

    function wp_rp_get_post_thumbnail_img($related_post) {
    //...
    
    	$postContent = $related_post->post_content;
    	if (preg_match('/.*<img.+src=["]([^"]+)["].*/i', $postContent, $imgMatch)) {
    		$img = '<img src="'. $imgMatch[1] . '" alt="' . esc_attr(wptexturize($related_post->post_title)) . '" />';
    		return $img;
    	}
    //...
    }

    It would be nice if you add this to your code.

Viewing 1 replies (of 1 total)
  • Plugin Author jureham

    (@jureham)

    Hi,
    we were thinking about adding this functionality but decided against it for now because it gets a bit complicated when you try to resize those images for thumbnails(150x150px).

    It’s definitely doable but hard to maintain with different versions of WordPress.

Viewing 1 replies (of 1 total)
  • The topic ‘[Plugin: WordPress Related Posts] Support Intext Images’ is closed to new replies.