Have you ever wanted to add an external RSS feed to your WordPress blog? This is a great way to promote one of your other blogs (if it is in a similar niche) on a more popular site you run.
Most of you will probably remember that about a month ago we finally got around to launching our WordPress Forums, which has an RSS feed associated with it. In order to cross-promote our forums on this site, I wanted to display our most recent forum posts in the sidebar here at WordPress Hacks.
In order to accomplish this, I grabbed the following code from Jean’s post over at Smashing Magazine:
<?php include_once(ABSPATH.WPINC.'/rss.php');
wp_rss('http://wpforums.com/external.php?type=RSS2', 5); ?>
It takes the rss.php file that is built into WordPress (used for widgets). In this code it is set to display the most recent 5 posts from the RSS feed “http://wpforums.com/external.php?type=RSS2.”
Here is how it looks:
I have gone ahead and added this to our WordPress Code page for easy reference.




Friday, December 12th, 2008 at 10:05 am
I think there is native widget for that as well?
I use “KB Advanced RSS” plugin - for showings custom software updates feed in my sidebar. Needed something customizable to showing two different links on each item (post and download).
Friday, December 12th, 2008 at 1:48 pm
@ Rarst - Yes, there is a widget for RSS feeds, though this gives you a little more control and can be placed anywhere (not forced to use sidebar or other widget enabled areas).
Maybe I’m weird, but I prefer hard coding things.
Saturday, December 13th, 2008 at 8:33 am
I’ve tryed to use it fetching another wordpress url but it gives an error saying the feed probably doesn’t exist but it does…
Saturday, December 13th, 2008 at 10:22 am
I just discovered your blog and just finished reading it page to page. Thanks for this nice tips
Saturday, December 13th, 2008 at 7:41 pm
very informative site, i will to add another RSS on my site.. thanks for the tip. keep up the good work.
Monday, January 19th, 2009 at 11:54 am
great - just added it to my singlepost.php and page template and it works 100%
Thanks a million
Sunday, February 15th, 2009 at 3:34 am
Thanks for the tip. I assume that this piece of code will have to be added to the template file, right. My problem is that I only want the feed to show up in the body of one page (not all my pages). Any idea how I can do that?
Trackbacks/Pingbacks
Leave A Comment
Become one of our
Featured Sites
Recent Trackbacks
Contributing Authors
Archives
Extras
WordPress Hacks Copyright © 2007-2009 | An Apricot Media Website
Template by StudioPress | Custom Design by Kyle Eslick and Blog Design Studio
RSS Feed Email RSS