WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?

share|improve this question

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. .

share|improve this answer

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.

share|improve this answer

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.

share|improve this answer
    
That’s not an image from the other site. – toscho Nov 5 '12 at 3:49

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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