Jump to content
Sign in to follow this  
puntNL

Add Media to RSS

Recommended Posts

puntNL

Hi Folks I want to add my posts thumbnail to my rss feed. Therefor I added this code to PP functions.php file: // show post thumbnails in feeds function diw_post_thumbnail_feeds($content) { global $post; if(has_post_thumbnail($post->ID)) { $content = '

' . get_the_post_thumbnail($post->ID) . '
' . $content; } return $content; } add_filter('the_excerpt_rss', 'diw_post_thumbnail_feeds'); add_filter('the_content_feed', 'diw_post_thumbnail_feeds'); This works, however, it adds the published image file of each posts instead of the 150px X 150px thumbnail/featured version image file. Does anybody know how to add the featured image thumbnail in the correct size to the feed?

Share this post


Link to post
Share on other sites
Simon
http://codex.wordpress.org/Function_Reference/get_the_post_thumbnail

Share this post


Link to post
Share on other sites
puntNL
Fixed it with help of http://webdesignzo.com/show-featured-images-in-rss-feed-feedburner/ Use this code in your function.php function featuredtoRSS($content) { global $post; if ( has_post_thumbnail( $post->ID ) ){ $content = '' . get_the_post_thumbnail( $post->ID, 'thumbnail', array( 'style' => 'float:left; margin:0 15px 15px 0;' ) ) . '' . $content; } return $content; } add_filter('the_excerpt_rss', 'featuredtoRSS'); add_filter('the_content_feed', 'featuredtoRSS'); Size of the Featured Images: This tip will add featured image with ???thumbnail??? size and it will be shown from the left side of the post excerpt, but you can change it. In the this line: . get_the_post_thumbnail( $post->ID, 'thumbnail' change the word ???thumbnail??? to ???medium???, ???large??? or ???full??? (???full??™ will show the original size of your thumbnail image,

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this  

×