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.

Want automatic updates? Subscribe to our RSS feed or
Get Email Updates sent directly to your inbox!
Tweet This | Digg This | Stumble it | Add to Del.icio.us | | Print This

Kyle Eslick

Kyle Eslick is the founder and primary author of WordPress Hacks. You can learn more about him at KyleEslick.com or you can follow his personal tweets here.

There Are 10 Responses So Far »

  1. Rarst says:

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

  2. Kyle Eslick says:

    @ 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. :D

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

  4. Deca says:

    I just discovered your blog and just finished reading it page to page. Thanks for this nice tips

  5. edzzy says:

    very informative site, i will to add another RSS on my site.. thanks for the tip. keep up the good work. ;)

  6. jackie says:

    great – just added it to my singlepost.php and page template and it works 100%

    Thanks a million :D

  7. Aaron says:

    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?

  8. Kenneth says:

    Is it possible to change the output to show more things like text, images etc…

  9. John Weaver says:

    Your method is described more easily. I have also written a post on this topic on my blog which is called Wordpress: Displaying External RSS Feeds

    But I have redirected visitors to SimplePie which is at the core of the feed fetching mechanism built in wordpress.

  10. kailoon says:

    Is it possible to get the image from the posts too ?

Trackbacks/Pingbacks »

Leave a Reply