我有一个wordpress博客http://cgvector.com,我想在RSS Feed中显示精选图像.我怎样才能做到这一点?我的Feed地址是:http://feeds.feedburner.com/cgvector
我已添加此代码,但它无法正常工作.
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');
解决方法:
function custom_feed($content) {
return wp_get_attachment_image(get_post_thumbnail_id(), 'full') . '<br />' . $content;
}
add_filter('the_content_feed', 'custom_feed');
这个应该为你做的伎俩……