Friday, December 12, 2008

Hack WordPress

Hack WordPress

How To: Adding an External RSS Feed to Your WordPress Blog

Posted: 12 Dec 2008 02:00 AM CST

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.

Related posts:

  1. Promote Your Blog Archives By Adding Related Posts To Your Feed
  2. Huge Compilation of WordPress Code
  3. Use the Feed Footer WordPress Plugin to Add Content To Your Feed
  4. Code: Adding Recent Comments To Your WordPress Theme

No comments:

Related Posts Plugin for WordPress, Blogger...

MP3 Clips

Popular Posts