RSSにアイキャッチ画像を含める

Ads

Code

<?php
function post_thumbnail_in_feeds($content) {
global $post;
if(has_post_thumbnail($post->ID)) {
$content = '<div>' . get_the_post_thumbnail($post->ID) . '</div>' . $content;
}
return $content;
}
add_filter('the_excerpt_rss', 'post_thumbnail_in_feeds');
add_filter('the_content_feed', 'post_thumbnail_in_feeds');
?>
view raw gistfile1.aw hosted with ❤ by GitHub

Screen shot

Note

Description functions.phpに追記。アイキャッチに登録した画像をRSSにも含める。
WordPress Ver. 3.3.1
Via Show Post Thumbnails in Feeds