5

Is there any way to show an image for RSS feeds in my WordPress page? Currently the default WordPress RSS feeds will only show the text of feeds from other sites. How can I make my site show a thumbnail image of RSS feeds of the other sites?

3 Answers 3

6

SimplePie, which ships with WordPress, does support images in feeds. Please see the SimplePie Reference if you need to look for specific functions regarding images.

If you want to display images from feeds on your own site, you could for example create a plugin containing a custom widget that reads a feed for images. For example with the get_feed_tags() function to look for IMG-tags. Those can be displayed by the widget then.

Be carefull not to inject content into your site you do not want to inject because of security reasons etc. .

1

While researching another question, I found the Anyfeed Slideshow plugin, that shows images in RSS feeds. I don't know how good it is displaying both text and images, but if your feed is image-focused (like a Flickr feed), this will probably do what you want.

-1

I also was searching for adding thumbnails to my feeds. I found a solution which I'm not sure if it is a best way, but it works. I used RSS Image Widget plugin, and made some changes to the code:

$desc = $item->get_description();
if(strlen($desc)>50)
   $desc = wp_html_excerpt($desc, 50).' ... ';
$blog_title = $item->get_title();
if(strlen($blog_title)>45)
   $blog_title = wp_html_excerpt($blog_title, 45).' ... ';

echo '<div class="rss_image">
      <a title="'.$item->get_title().'" href="'.$item->get_permalink().'"><img src="'.get_bloginfo('wpurl').'/wp-content/cache/rss_image_cache_'.date('n').'/'.$image_thumb.'" alt="'.$item->get_title().'" /></a>
        <h5><a title="'.$item->get_title().'" href="'.$item->get_permalink().'">'.$blog_title.'</a></h5><p>'.$desc.'</p>
    </div><br />';

Also it's worth mentioning that on the source blog images were included in the feed.

1
  • That’s not an image from the other site.
    – fuxia
    Commented Nov 5, 2012 at 3:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.