Support » Plugins » I want my images to show in RSS feed but doesn't work

  • femkedam

    (@femkedam)


    Hi,
    I’m trying to figure out how I can get my images to show up in the RSS feed. I already installed a plugin but it doesn’t seem to work.
    I don’t want the whole post to show in the RSS, just the first image.
    Also now I don’t see any pictures in my bloglovin profile.

    Hope someone can help me with a simple solution for this.

    Thanks in advance!
    Femke

    My blog: http://www.somewheresomethingblog.com

Viewing 6 replies - 1 through 6 (of 6 total)
  • Maby this helps:
    [ link deleted ]

    it shows the post’s featured image in your rss feed.

    Moderator Jan Dembowski

    (@jdembowski)

    Forum Moderator and Brute Squad

    Gerald? Can you please refrain from sending users to your site that way? It helps people more and as you’re probably aware sending users to your site can and has been abused.

    You can easily share your code like so.

    /**
     * Snippet Name: show featured image in rss feed
     */
     function wpc_featured_image_in_feed( $content ) {
        global $post;
        if( is_feed() ) {
            if ( has_post_thumbnail( $post->ID ) ){
                $output = get_the_post_thumbnail( $post->ID, 'medium' ) );
                $content = $output . $content;
            }
        }
        return $content;
    }
    add_filter( 'the_content_feed', 'wpc_featured_image_in_feed' );
    Moderator Jan Dembowski

    (@jdembowski)

    Forum Moderator and Brute Squad

    Also (and I’m replying again to generate that email) I am not attributing any bad motives and I do applaud you helping here! But please do keep it here when possible.

    Hi Jan,
    sure no problem. Sorry.
    I just added exactly that function minutes before reading that post here.
    And as you see my site’s concept is excactly the opposite of harming any WordPress user 🙂
    But sure I understand your point.

    Thread Starter femkedam

    (@femkedam)

    Thanks, I tried it with this code (it’s in my childtheme) but now I only get codes when I go to my feed: http://www.somewheresomethingblog.com/feed/
    What am I doing wrong?

    sorry, there’s one bracket too much – replace the line with this:
    $output = get_the_post_thumbnail( $post->ID, 'medium' );

    I tried it again and it returns the proper img data which should look similar to this:

    <content:encoded>
    <![CDATA[
    <img width="300" height="224" src="your-img-url" class="attachment-medium wp-post-image" alt="">
    ]]>
    </content:encoded>

    please try to update your latest post (which has a featured image) and refresh your feed url.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘I want my images to show in RSS feed but doesn't work’ is closed to new replies.