Feed Image Wordpress Plugin

by Terri Ann on December 2, 2007

After reading the article Adding a logo to your WordPress RSS Feed on onenaught.com I decided it was times to write another plugin. the solution of adding a function to WordPress’ build in functions.php file wasn’t optimal for me.

Check this plugin in action on the Ninedays Blog RSS Feed

Feed Image

This is the first plugin I’ve written that has an options page, thanks to this article Adding options to WordPress plugins.

Just a few things to customize in the option page (Options > Feed Image) updating the path to your ico file as well as your logo.

Feed Image Options Page

The icon and logo must reside within the domain your blog is installed, to prevent any potential hot linking. You’ll see the results in your RSS, RSS2 as well as your Atom feed.

Download

Changelog

  • 1.02 – Updated to add the image to RSS as well as RSS2 and Atom Feeds (thanks Sophia!) (May 28, 2008)
  • 1.01 – Updated some sloppy naming conventions and conditional statements (thanks Ragaskar!) (January 7, 2008)
  • 1.0 – Created & released (December 2, 2007)

Requirements

  • Tested on WordPress 2.3 and above

Installation

Check out the WordPress documentation on Installing Plugins.

Roadmap

In the future I plan on adding the ability to upload images, and adding a field to allow for image attachments for each post like the Yahoo! News RSS feed. I would also like to have the script measure the image size automatically.

Inspired By

  1. Necessity, the greatest inspiration of all
  2. Adding a logo to your WordPress RSS Feed
  3. Plugin development really helps me understand how the core of Wordpress works and insight into well maintained web applications is a great learning experience.

{ 5 trackbacks }

Adding a logo to your WordPress RSS Feed — onenaught.com
December 8, 2007 at 11:42 am
the b-world
May 17, 2008 at 2:55 am
[scribkin] Scribkin’s WordPress Plugins - Let Me Show You Them
May 17, 2008 at 3:42 pm
עולם הפידים- rss » ITbananas
June 14, 2008 at 7:30 pm
Observations from Uppsala » Off-Topic: Custom RSS Feed Icon
January 5, 2009 at 2:50 am

{ 5 comments… read them below or add one }

1 ragaskar January 3, 2008 at 6:07 pm

Nicely done, however, you need to fix the following conditional branch:

if(isset($_REQUEST['feed_logo'])){
    $logo_filename = $_REQUEST['feed_logo'];
    update_option('feed_logo', $logo_filename);
}

should read

if(isset($_REQUEST['feed_image'])){
    $logo_filename = $_REQUEST['feed_image'];
    update_option('feed_logo', $logo_filename);
}

Alternatively, you could change

    <label for="feed_icon"><strong>Feed Logo:</strong></label> 
        <?php echo get_bloginfo('url'); ?>/<input type name="feed_image" value="<?php echo $default_logo; ?>" size="35" />
        <small><em>Use an image file (jpg, png, gif)</em></small>

to

    <label for="feed_icon"><strong>Feed Logo:</strong></label> 
        <?php echo get_bloginfo('url'); ?>/<input type name="feed_logo" value="<?php echo $default_logo; ?>" size="35" />
        <small><em>Use an image file (jpg, png, gif)</em></small>

which is probably preferable for troubleshooting reasons, as you keep the names consistent.

Also, you might consider dropping the auto-path and just pre-popping a text-field with the current wordpress root, so users can put in a full URL instead of just a path under the wordpress root. My wordpress root is not the same as my web root, and for organizational reasons, it sometimes makes more sense to not dupe items into my wordpress install dir.

2 Terri Ann January 7, 2008 at 12:50 pm

Thanks ragaskar, I’ve updated the form fields and double checked all my other naming conventions for consistency!

3 Sophia May 27, 2008 at 7:26 pm

I updated the feed image options and am not able to tell if it worked. Any suggestions? I clicked on my rss feed, but did not see any images.

4 Terri Ann May 28, 2008 at 12:43 pm

@Sophia – I see it in your atom feed and your RSS2 Feed but not your RSS feed I’ll have to look into this a little later this evening. I really haven’t touched this plugin for a while so I’m surprised this hasn’t been brought to my attention yet.

In the meanwhile why not switch your RSS to RSS2, it is the newer standard for RSS I believe, honestly RSS isn’t my strongest suit!

5 Joost de Valk July 14, 2008 at 4:18 pm

Hi Terri,

I’ve got some suggestions for this plugin, to clean up the code and reduce on database action etc. Could you drop me a line? :)

Cheers, Joost

Leave a Comment

Previous post:

Next post: