WordPress.org

Ready to get started?Download WordPress

Forums

WordPress Related Posts
[resolved] Support Intext Images (2 posts)

  1. saschanord
    Member
    Posted 1 year ago #

    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.

  2. jureham
    Member
    Plugin Author

    Posted 1 year ago #

    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.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.