WordPress makes it super-easy to publish your own content, and even easier to import and display content from other great sites around the Web. Just as other people are displaying and reading your feed in their apps and devices, you can use external RSS feeds to supplement and strengthen your site’s primary content.
Whether you’re displaying feeds from similar sites or aggregating news from around the world, importing feeds means taking advantage of the best that the Web has to offer. In this post, you’ll see how easy it is to grab external RSS feeds and display them anywhere on your WordPress-powered site
Why do it?
No website is an island, and with a virtually infinite assortment of content and services around the Web, there’s no reason not to take advantage of content that will benefit your readers and help improve the overall quality and content of your site. Feeding external RSS content to WordPress:
- adds relevant, useful content for your readers to enjoy
- adds relevant, targeted keywords for search-engine robots
- keep visitors on your site by giving them the content they want.
Depending on your niche, using external content opens up many possibilities. Here are some concrete examples to help illustrate some common ways RSS feeds are used to create and supplement content:
- news sites importing weather feeds to display current conditions
- sports sites importing news feeds reporting the latest sports news
- investment sites displaying current market values and stock prices.
For blogs, the possibilities are only limited by your imagination. I’ve seen some great independent sites that make excellent use of external feeds. Here are some examples:
- blogs that display their social media feeds, such as Twitter and Facebook
- bloggers with more than one website displaying posts from their other sites
- news-portal sites that aggregate the best blogging and/or web design feeds.
And the best part? WordPress makes it so easy to integrate external RSS feeds that it’s almost funny. Depending on your goals and experience with WordPress, there are several ways to go about doing it: using widgets, plugins, or manual coding. Let’s examine these different techniques and explore everything you need to import and display RSS feeds with WordPress.
Displaying feeds with the default RSS widget
As seen in the screenshot above, the default RSS widget provides several basic options, including number of feed items and which elements to display. Yes, it’s super-easy, but your customization choices are limited. As a general rule, the more stuff (e.g. post title, post date, author name, and so on) you include with each feed item, the more cluttered it tends to look.
Seriously, a linked title and post excerpt is all you really need to display, and doing so keeps things looking clean. Unfortunately, even after limiting our display options to only “title and excerpt”, the output using the default WordPress theme looks sloppy:
…and the posts just continue all the way down the sidebar. If you’re handy with CSS, adding a few rules to your
style.php may be all that’s needed to slap things into shape, but clearly more control is desired for better customization.
Displaying feeds with WordPress plugins
For more control when you’re working with external feeds, there a number of excellent plugins available. Let’s have a look at the best plugins for importing and displaying external RSS feeds. Note: all plugins have been tested/reviewed with current versions at the time of this posting, and working with the latest version of WordPress, 3.0.2.
- FeedWordPress: import feed content as posts.
- WP-o-Matic: import feed content as posts.
- RSSImport: display feed content anywhere.
A good sign of a reputable WordPress plugin is how many times it has been downloaded. So with over 300,000 downloads, FeedWordPress by Charles Johnson is definitely worth checking out. It’s an incredibly powerful, flexible plugin that makes importing and customizing feed content extremely easy. Here’s a screenshot of the Settings page:
But FeedWordPress does way more than just display external feed content on your site—it actually creates a post for each imported feed item. So, for example, if I want to back up my latest Twitter tweets, I can either create an entire tweet archive, or I can let FeedWordPress do it for me. FeedWordPress installs easily, and imports any number of feeds using the following default settings:
- Auto-updates are turned off by default; cron may be configured, or just use manual fetching.
- Auto-import and create categories, tags, and even authors (as contributors) for each feed item.
- Titles for feed items are auto-linked to the source, so there are no single-page views or comments.
Of course, all of these options may be configured to your liking using the FeedWordPress Settings page. Other useful settings enable you to mark imported posts as drafts or private, update posts to match changed feed content, and much more. To get started, check out the FeedWordPress Quick-start Guide.
Another incredible plugin for importing feed content as posts, WP-o-Matic is very similar to FeedWordPress, but with some different features and slightly easier configuration. After installing the plugin, hit the Settings page for an easy, four-step configuration process:
- Run compatibility check.
- Configure time-zone settings.
- Configure cron settings (via WebCron, crontab, unix cron, or manual fetching).
- You’re done!
After configuration, you can begin importing feeds by creating a new Campaign and setting the following options:
- feed title, slug, URL, and category
- any regex pattern-matching on key terms (optional)
- configuration of optional Custom import/post template and polling frequency
- setting discussion preferences and whether to send pingbacks
- setting whether title links should point to single-view page or content source.
In addition to importing and customizing any number of feeds, WP-o-Matic also enables image caching and provides some great import/export tools. Also worth mentioning is that WP-o-Matic doesn’t import any categories, tags, or users by default. Here’s a screenshot of the Settings page:
For importing feeds as post content, WP-o-Matic and FeedWordPress are excellent plugins that make things easy while providing much control over the configuration and customization of the entire process.
If you want to display external feeds without creating posts, the RSSImport plugin is really all you need. RSSImport enables you to import and display feeds using a shortcode, widget, or PHP template tags. And it does this using WordPress’s built-in feed-parsing functionality, via MagpieRSS (for WP 2.8+) or SimplePie (for older WP).
RSSImport makes it seriously easy to display any feed anywhere in your theme—and with massive flexibility. Here are three ways to do it with RSSImport:
- Display feeds in any widgetized area.
- Display feeds in posts using a shortcode.
- Display feed content anywhere in your theme.
Display feed content using the RSSImport widget
To display external feeds in the sidebar (or any other widgetized area), just install the plugin and visit the Widgets page. There you will find options for everything under the sun, giving you full control over many configuration options. Here is a screenshot showing a few of the widget’s many settings:
Setting things up with the widget is really just a matter of going through the options and making sure everything is exactly how you want it. Bada-boom, bada-bing, as they say.
Display feed content using a shortcode
RSSImport also makes it easy to display feed content right in your posts and pages using a shortcode. Here is the simplest example, showing the five most-recent feed items from Digging into WordPress:
[RSSImport display="5" feedurl="http://feeds2.feedburner.com/DiggingIntoWordpress"]
That works perfectly, but there are many parameters available for customization. I’ve included a more involved example, using as many parameters as possible, in the downloadable code for this post.
So with the widget, RSSImport lets us display feed content in any widgetized area. And now with the shortcode, we can display feeds right in your posts and pages. But if we still desire even more control, we can get our hands dirty and modify our theme template files directly.
Display feed content anywhere in your theme
Direct modification of theme (or child theme) template files isn’t for everyone, but for complete control over configuration and customization, you may need to go there. I’s really no big deal, though—just pick a spot in your theme and add the following line of PHP code:
Just like with the widget and shortcode methods, you can use any of the RSSImport parameters to customize feed display any way you wish. Check out RSSImport at the Plugin Directory for complete details.
Displaying Feeds with WordPress’s built-in functionality
WordPress has a built-in way of displaying feeds using the
fetch_feed function. Using the
fetch_feed function means we have one less plugin to fiddle with and maintain, so if you feel comfortable working with basic PHP and WordPress template tags, then you’ll love how easy it is to import and display external feeds. To illustrate, paste this snippet anywhere in your theme (e.g.
sidebar.php). Note that this code is also included in the download:
Here is a more complete example that shows how to grab different parts of the feed and display them as a nice definition list (this code is also included in the download):
The easiest way to understand this code is to just plop it into your theme file and look at the results on your site. Some of the highlights include:
- an error-check in line 5
- use of
$rss->get_title();to display the feed title
- use of
$item->get_permalink();to display each item’s permalink
- use of
$item->get_date();to display the post date for each item
- use of
$item->get_title();to display the title for each item
- use of
$item->get_description();to display the content of each item.
When working directly with template code, you have full control over the markup used to display your feeds. Throw in a little CSS and you’re equipped to rule the world.
SEO and other considerations
In closing, here are some things to keep in mind when working with external feeds:
- Don’t steal, get permission—if in doubt, contact the publisher of the feed and ask.
- If using WP-o-Matic, you may want to link target keywords and phrases using the regex feature.
- Give proper link credit to the source of any feed(s) you use—otherwise it’s too shady.
- Linking titles back to the source is good practice, but feel free to strip links from excerpts.
- Don’t auto-fetch feeds more than once or twice per hour. If you need to update more frequently, get permission.
Bottom line: if in doubt, get permission. And always link back to the source. Everything else is up to you!
Jeff Starr is a web developer, graphic designer and content producer with over 10 years of experience and a passion for quality and detail. Jeff is co-author of the book Digging into WordPress and strives to help people be the best they can be on the Web. Read more from Jeff at Perishable Press or hire him at Monzilla Media.
A Note from Darren: I can only really echo the call to ‘get permission’ when importing other people’s feeds. I’d also warn against simply reposting other people’s feeds in full – particularly if that’s all you do primarily on your blog. To do means you’re not really creating unique content – this isn’t great for readers but also signals to search engines that you’re just creating duplicate content (meaning you’ll never really rank too high for that content).
Keep in mind that successful blogs are built on unique and useful content. Importing feeds might seem like a quick way to generate content – but it does little to build your authority, voice or a relationship with readers.