Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Sutherland Boswell

    (@sutherlandboswell)

    The following code which can be added to functions.php in your theme is from this thread and is a global way to include the featured image (regardless if it is a video thumbnail) in RSS.

    // THIS INCLUDES THE THUMBNAIL IN OUR RSS FEED
    function insertThumbnailRSS($content) {
        global $post;
        if ( has_post_thumbnail( $post->ID ) ){
            $content = '' . get_the_post_thumbnail( $post->ID, 'thumbnail', array( 'alt' => get_the_title(), 'title' => get_the_title(), 'style' => 'float:right;' ) ) . '' . $content;
        }
        return $content;
    }
    add_filter('the_excerpt_rss', 'insertThumbnailRSS');
    add_filter('the_content_feed', 'insertThumbnailRSS');
    Thread Starter kareemsayeed

    (@kareemsayeed)

    Thank you, but unfortunately this only adds the featured image and not the video thumbnail. The reason I need the video thumbnail to show in the rss feed is because 100% video thumbnails are generated when I create a post but only 50% of the time a featured image is generated. All my social media accounts post the content in the rss feed. So I need to figure out a way.

    Plugin Author Sutherland Boswell

    (@sutherlandboswell)

    Same basic concept, but this code gets the video thumbnail instead of featured image:

    // THIS INCLUDES THE VIDEO THUMBNAIL IN OUR RSS FEED
    function insertVideoThumbnailRSS($content) {
    	global $post;
    	if ( get_video_thumbnail( $post->ID ) != null ) {
    		$content = '<img src="' . get_video_thumbnail( $post->ID ) . '" />' . $content;
    	}
    	return $content;
    }
    add_filter('the_excerpt_rss', 'insertVideoThumbnailRSS');
    add_filter('the_content_feed', 'insertVideoThumbnailRSS');
    Thread Starter kareemsayeed

    (@kareemsayeed)

    Thank you! It was causing my site to go entirely blank though (maybe theme related issue?) So I slightly modified it and its running great!

    // THIS INCLUDES THE THUMBNAIL IN OUR RSS FEED
    function insertVideoThumbnailRSS($content) {
    global $post;
    if ( get_video_thumbnail( $post->ID ) ){
    $content = ‘<img src=”‘ . get_video_thumbnail( $post->ID ) . ‘” />’ . $content;
    }
    return $content;
    }
    add_filter(‘the_excerpt_rss’, ‘insertVideoThumbnailRSS’);
    add_filter(‘the_content_feed’, ‘insertVideoThumbnailRSS’);

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Adding Video Thumnails to Rss Feed?’ is closed to new replies.