为什么不在我的Wordpress RSS Feed中添加图像呢?

时间:2015-08-09 10:33:12

标签: php wordpress wordpress-plugin rss

我的RSS Feed目前不显示任何图片。

http://getthebasicsright.com/blog/feed/

我正在使用的主题是剪纸,并进行了一些调整。

我尝试了以下3种方法将特色图像添加到rss Feed中,但它们都没有工作。

请告诉我如何解决这个问题?

我在functions.php中尝试过这段代码(现在这段代码已经存在,所以你可以看到它无效)

function featuredtoRSS($content) {
global $post;
if ( has_post_thumbnail( $post->ID ) ){
$content = '<div>' . get_the_post_thumbnail( $post->ID, 'medium', array( 'style' => 'margin-bottom: 15px;' ) ) . '</div>' . $content;
}
return $content;
}

add_filter('the_excerpt_rss', 'featuredtoRSS');
add_filter('the_content_feed', 'featuredtoRSS');

我在functions.php

中尝试过这段代码
add_filter( 'the_content', 'featured_image_in_feed' );
function featured_image_in_feed( $content ) {
    global $post;
    if( is_feed() ) {
        if ( has_post_thumbnail( $post->ID ) ){
            $output = get_the_post_thumbnail( $post->ID, 'medium', array( 'style' => 'float:right; margin:0 0 10px 10px;' ) );
            $content = $output . $content;
        }
    }
    return $content;
}

我试过这个插件

https://wordpress.org/plugins/rss-image-feed/

0 个答案:

没有答案
相关问题