Apr
17th

Publish External Feeds in Your Wordpress Site

Some folks don’t realize it, but Wordpress has integrated the ability to publish other feeds with some out of the box features. I’ve written in the past on how to publish a blog’s feed to give a boost to a site’s keyword density for improved search engine optimization - but this is how to do it right within Wordpress.

Wordpress has embedded Magpie and RSS Caching within its available functions:

  • fetch_rss — retrieve an RSS feed from a URL with automatic caching (included in rss_functions.php)
  • wp_rss — retrieve and display an RSS feed as an unordered list (included in rss_functions.php)
  • get_rss — retrieve and display an RSS feed as a list (ordering optional) (included in rss_functions.php)

IMO, the first method is the most useful because of the automatic caching. If you’d like to, for example, add a

<h2><?php _e(‘Social Media Events’); ?></h2>
<?php // Get RSS Feed(s)
include_once(ABSPATH WPINC ‘/rss.php’);
$rss fetch_rss(
http://eventful.com/rss/events/?q=%22social%20media%22&location_type=&location_id=&l=Worldwide’);
$maxitems 5;
$items array_slice($rss->items0$maxitems);
?>

<ul>
<?php if (empty($items)) echo ‘<li>No items</li>’;
else
foreach ( 
$items as $item ) : ?>
<li><a href=’<?php echo $item['link']; ?>‘ 
title=’<?php echo $item['title']; ?>‘>
<?php echo $item['title']; ?>
</a></li>
<?php endforeach; ?>
</ul>

Edit your Wordpress template (Design > Theme Editor) and place the code above in your sidebar or on an events page. That’s it - now you have a live feed of events in your sidebar that you never have to update! This can really come in handy. I’ve done just that at I Choose Indy!, where I’ve published the Event feed from Smaller Indiana.

For more advanced users, you can put this in your single page theme and, perhaps, enter a search term as a Custom Field to add other bloggers’ posts on the same topics.

You might also find these posts interesting:

RSS feed | Trackback URI

4 Comments »

Comment by no imageStephen James (SezWho)
2008-04-17 08:27:33

You can republish your own content, too, not just others. I’ve done this for a while at SMJdesign since all it is a blog that is an aggregation of my four blogs. I prefer using FeedList plugin instead of the built in RSS functionality.

You can use this for a Twitter sideblog or anything that has an RSS feed!

Rate this:
2.9
Comment by no imageDouglas Karr (SezWho)
2008-04-17 09:30:41

Good to see you on the circle, Stephen! Curious of the advantages of the plugin over the built in features? Is it simply the interface? I like the fact that caching is built into the internal function - for high volume days/sites, that could come in handy!

Cheers!
Doug

Rate this:
2.9
 
 
Comment by no imageWilliam Tully (SezWho)
2008-04-17 14:01:11

Brilliant - this is exactly what I need! I’ve been working on a WP MU site and I simply want the main blog to just show a page with a nice graphic for each of the blogs. Now, I can add in a couple posts under each graphic rather than have them hang out on the sidebar using the RSS widget.
Rate this:
2.9
Comment by no imageDouglas Karr (SezWho)
2008-04-17 15:58:21

Awesome, William!

The funny part is I was half-way down the road of implementing MagPie when I decided to check the WP site out to see how others might be doing it. Those folks at WP really do a fantastic job, don’t they?

Doug

Rate this:
2.9
 
 
Name (required)
E-mail (required - never shown publicly)
URI
Your Comment (smaller size | larger size)
You may use <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> in your comment.

My Comment Policy: I moderate comments. Please be patient:

  • Spam will happily be destroyed.
  • Use your real name, not some keywords. Otherwise it will be destroyed.
  • Mean comments aren't necessary. If I don't post them I will reply personally to let you know why.
  • Lewd comments will be edited, I don't want my readers leaving because of offensive content.
Great debate, criticism and colorful commentary is always appreciated and approved!