Adding text and images to your feed
This is a basic function you can paste into your functions.php, and easily add custom content to your RSS feed when using WordPress. What this does is first check to see if it is the feed is_feed(), and if it is the feed, then it creates a variable called $content.
This variable is where you can add your custom text, images, or anything at all, as long as somewhere within it is the function call to the_content() like I have here after the logo image for New2WP. Notice that I use the single quote period before and after the function: ( ' . the_content() . ' ). This is to properly concatenate the variable since the function is Php.
After this variable it will return it, thereby displaying it in your feed as the_content() which should be shown.
function insertRss($content) { if( is_feed()) { $content = '<a href="http://new2wp.com"><img src="http://new2wp.com/wp-content/themes/New2WP/images/new2wp-logo.png" alt="New2WP - A Resource for WordPress Tutorials, Tips, Tricks and More!" /></a><br /><br /> TEXT BEFORE CONTENT' . $content . '<a href="http://new2wp.com"><img src="http://new2wp.com/wp-content/uploads/2010/06/new2wp-468x60px.png" alt="New2WP - A Resource for WordPress Tutorials, Tips, Tricks and More!" /></a>'; } return $content; }
There's several ways you could do this differently
For example, you could set the_content() as the value of a variable prior to this, say $thecontent = the_content();, and then when you create the $content you can use double quotes around your content like:
$content = "THIS IS CUSTOM STUFF BEFORE $thecontent THIS IS CUSTOM STUFF AFTER";
This will work the same way since variables within double quotes in Php will parse the value that they are equal to. Using single quotes here, however, will just display the text $thecontent, since single quotes parse the literal variable and not what the variable equals.
Don't forget to add the filter
add_filter( 'the_content', 'insertRss' );
Finally, to make this complete and properly display your custom content in your feed, you need to add the hook to WordPress that makes it work and run as it should. So make sure to add the above filter to your functions.php file along with the function.
That's all there is to it. If you have any questions let me know in the comments.
To take this even further, learn how to add post thumbnails to your feeds, to add even more customization.