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