[tips]add post thumbnail post image into rss feed
the simplest way to do that to use add_filter function to pass your modified function to handle the rss and overwrite the default wordpress function
so add these lines in your theme -> functions.php
so add these lines in your theme -> functions.php
function rss_post_thumbnail($content) {
global $post;
$image = get_post_meta($post->ID, 'image', true);
if(!empty($image)){
$imgCode = '<img src="'.$image.'" border="0" />';
}else{
$imgCode = get_the_post_thumbnail($post->ID);
}
$content = '<p>' . $imgCode .
'</p>' . get_the_content();
return $content;
}
add_filter('the_excerpt_rss', 'rss_post_thumbnail');
add_filter('the_content_feed', 'rss_post_thumbnail');
0 Responses to "[tips]add post thumbnail post image into rss feed"
Post a Comment