【问题标题】:How to show thumnail picture/featured picture of the post in excerpt feed如何在摘要提要中显示帖子的缩略图/特色图片
【发布时间】:2014-02-17 18:03:52
【问题描述】:

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

有什么办法可以做到吗?

谢谢

【问题讨论】:

    标签: wordpress rss feed feedburner


    【解决方案1】:

    您可以在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');
    

    【讨论】:

    • 感谢您的回答,但这会被推送到 feedburner 的提要中吗?如您所见,我的提要中已经有图片来自我正在使用的主题bucatepealese.ro/feed,但如果我使用带有摘录选项的 feedburner,它不会显示任何图片。
    猜你喜欢
    • 2016-11-21
    • 1970-01-01
    • 1970-01-01
    • 2019-03-22
    • 2016-02-28
    • 1970-01-01
    • 2017-01-25
    • 1970-01-01
    • 2011-11-01
    相关资源
    最近更新 更多