0

因此,我将 feedburner 用于我的提要并使用该选项仅显示博客文章的摘录/摘要,唯一的问题是使用此选项而不是提要中的完整帖子,它不会向我显示图像,该帖子的特色图片。

有没有办法我可以做到这一点?

谢谢

4

1 回答 1

0

您可以在 functions.php 中使用以下示例代码在摘要提要中显示特色图像

//Function to add featured image in RSS feeds
function featured_image_in_rss($content){
    global $post;
    if (has_post_thumbnail($post->ID)){
        $content = '<div class="featured_image_post_rss">' . get_the_post_thumbnail($post->ID, 'medium', array('style' => 'margin:10px; text-align: center;')) . '</div>' . $content;
    }
    return $content;
}

//Add the filter for RSS feeds Excerpt
add_filter('the_excerpt_rss', 'featured_image_in_rss');

此外,如果您想将特色图片添加到内容提要中,只需在上述代码之外添加以下过滤器。

//Add the filter for RSS feed content
add_filter('the_content_feed', 'featured_image_in_rss');
于 2014-02-17T22:07:49.957 回答