Advertisements

If you maintain more than one blog or a forum, then you can display the RSS feed of your posts or articles from another website on your WordPress blog. This would in turn give more exposure to your posts written else where. Although there might be plugins to do this job, you can do this using just 2 lines of code. WordPress has a build in function to get the RSS feed of any website.

We used this query to get the RSS feed of our Mobile Blog in the sidebar. Here is the code.

<?php include_once(ABSPATH . WPINC . ‘/rss.php’);
wp_rss(’http://feeds2.feedburner.com/themobileblogin, 5); ?>

The first line of code is to call to RSS core file of WordPress and in the second line we specify the feed URL and the number of posts to be displayed using the wp_rss() function. You need to replace the feed URL with the URL you want to display in the sidebar. You can see the Mobile Blog posts showing up in the sidebar of this blog using this method.

Feed from another blog

You can also do some formatting using the <ul> and <li> based on your current theme style.

NB: If you are not comfortable adding the code, you might get some plugins to do the job, but it is always advisable to go with lesser number of plugins.

Thanks to WP Recipes for this tip.


5 Responses to “How to Display Any RSS Feed on Wordpress Blog”

  1. Satbir Singh says:

    Also, if your theme supports widgets then you can directly add RSS widget to your blog sidebar

  2. Blogsdna says:

    Yes, Widget supported themes can directly add RSS Widget which intern usages above code and rss.php to retrieve feeds

  3. [...] How to Display Any RSS Feed on Wordpress Blog [...]

  4. Binny V A says:

    Small error in the code. Second line must be..
    wp_rss(’http://feeds2.feedburner.com/themobileblogin’, 5); ?>

    The ending ‘ is missing.

  5. Rob says:

    What if you don’t want the RSS to go to a sidebar, but the actual main body of your website? I belong to an organisation that is globla and I’d like its news to appear in th emain body of my spin-off site, not just in a sidebar?

Leave a Reply