Display external RSS feeds in WordPress

Display bexternal RSS feeds in wordpress Displaying external RSS Feeds is quite common in blogs.

Typical sources can be external partners, general sources of inspiration, or sites that you admire.

In this post we’ll show you 2 methods for displaying external RSS feeds in WordPress –  the built in WordPress widget, and a stand alone code.

WordPress RSS Widget

WordPress has a built in sidebar widget that can display external RSS Feeds in your sidebar.

The advantage of this widget is, that it’s very easy to configure and install.

The downside is, that this widget can only be used for displaying RSS feeds in the sidebar, not on other positions on the page, and if you have very specific requirements, the sidebar can be limited in functionality.

You can find the RSS Widget here in the WordPress backend:

Appearance->Widgets

The widget is very easy to configure, just add the URL of the relevant feed, and specify how many items you want to display etc. etc.

The Internal RSS sidebar widget in WordPress

Custom code

If you want increased flexibility, or want to show the feed another place than in the sidebar, you need another solution than the built in WordPress RSS Widget.

The basic configuration of the RSS fetching script includes defining:

  • Feed address
  • Number of items to display

<?php include_once(ABSPATH.WPINC.'/feed.php');
 $rss = fetch_feed('<insert rss url here>');
 $max = $rss->get_item_quantity(<insert number of items here>);
 $rss_items = $rss->get_items(0, $max);
 ?>
 <ul>
 <?php if ($maxitems == 0) echo '<li>No items available</li>';
 else
 foreach ( $rss_items as $item ) : ?>
 <li>
 <a href='<?php echo $item->get_permalink(); ?>'
 title='<?php echo 'Posted '.$item->get_date('j F Y | g:i a'); ?>'>
 <?php echo $item->get_title(); ?></a>
 </li>
 <?php endforeach; ?>
 </ul>

You can then insert the code where ever you want on you WordPress pages, eg in the footer, at the end of posts etc. etc.

You can easily customize the script to include additional information or present the RSS items in a different way.

Conclusion

Displaying external RSS feeds is easy in WordPress. You can either use the included RSS sidebar widget, that makes it very easy to display external RSS feeds in your sidebar.

If you want to have further customization options, or place the RSS feed in another position than the sidebar, the Custom code makes it easy to get started.

Share and Enjoy

  • Facebook
  • Twitter
  • Delicious
  • LinkedIn
  • StumbleUpon
  • Add to favorites
  • Email
  • RSS
fold-left fold-right
About the author
Jørgen Nicolaisen has been passionately interested in everything online since 1995. His experience is based on working with small hobby projects as well as high volume websites. Jørgen is currently focused on the PHP based programming framework - Codeigniter, and WordPress naturally

2 Replies to Display external RSS feeds in WordPress

  1. anika says:

    goog post. But how to show image thumbnail of that rss in sidebar?

  2. jeff says:

    Anika, did you ever find the solution? I use exact same code and WordPress strips the tags so that instead of seeing the image, I see

    So, I basically see an ugly tag instead of the image. Been googling for a while, still no luck.

Comments are now closed for this article.