How to show RSS feeds in a WordPress Page and Posts
Most of the bloggers having different blogs (on same or other domain) wants to aggregate the updates on the same page. If you wants to show different blogs latest post links on a wordpress page then its very easy to show rss feeds within wordpress with the help of simplexml. The following codes displays the feeds from the single feed url.

$xml_file = 'http://feeds.feedburner.com/honeytechblog';
$xml = simplexml_load_file($xml_file);
$xml_channel = $xml->channel->item;
for ($i=0; $i<5; $i++) {
//print_r($result);
?>
<div>
<a href="<?php echo $xml_channel[$i]->link; ?>">
<?php
echo $xml_channel[$i]->title."</a></div>";
}
?>
There are some parameters which can customize your requirements like:
- $xml_file = Feed Url for example i use
$xml_file = 'http://feeds.feedburner.com/honeytechblog';
- Value of i for no of links, for example i<5 shows 5 links of the feed
Alternate Code
(tested on various clients blogs)
<?php
error_reporting(0);
$url = "http://feeds.feedburner.com/micro-news";
$xml = simplexml_load_file($url, 'SimpleXMLElement', LIBXML_NOCDATA);
echo $xml;
if ($xml == "")
{
echo "Feeds are down, Try again later";
}
else
{
$blog = $xml->channel;
for($i=0; $i<3; $i++) {
?>
<li><a href="<?php echo $blog->item[$i]->link; ?>"><?php echo $blog->item[$i]->title; ?></a> </li>
<?php
}
}
?>
</ul>
Note
If you wants to run this php code apart from the WordPress themes i.e in wordpress posts and pages then you need plugins like Exec-PHP. Exec-PHP will executes PHP code in posts, pages and text widgets .
This post is dedicated as an answer to amitbhawani question
Is there any WordPress Plugin which shows 5 Recent Posts of any Feed in a WordPress Page? Ex :Show my news blog latest posts on about page
You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.
Similar Interesting Posts
- How to add custom twitter updates in blogs using php
- 10 ways to increase your feed subscribers
- How to hide a categories posts from wordpress RSS Feeds without using any plugin
- 101 List Of Awesome WordPress Tips and Resources
- How to display Tag Clouds without using any WordPress Plugins
- Top 25 twitter tools for WordPress
- How to add Youtube channel on Facebook Static FBML
- Top 20 wordpress plugins that you can’t miss
- Top 40 Featured WordPress Video Tutorials
- How to check Broken Links of WordPress Blogs
Tutorials On
- How to fix IE6 PNG Transparency issues in wordpress
- How to redirect wordpress.com blog to self hosted domain
- How to optimize website loading time and performance
- How to add featured content slider into wordpress blog
- How to upgrade / unlock your iPhone in 15 minutes
Designs
- 50 Inspiring Book Cover Designs
- 50 Inspirational Web Portfolios
- 50 examples of Creative Art Typography
- 10 Photoshop Tutorials
- 10 Flash Resources
- 10 Web Design Forums
- 10 HTML / CSS Resources
- 10 Places for a Web Designer to Make Money Online








October 10th, 2009 at 8:34 pm
@amitbhawani to show RSS feeds in a WordPress Pages and Posts http://bit.ly/QW6Zv
October 10th, 2009 at 8:55 pm
Did you try out this stuff on one of your post / page? Iam asking this because the code is not executing itself and i guess we need to upload some files?
October 11th, 2009 at 12:23 am
@Amit
I already tested the above codes on various blogs.
There is no need to upload any external files in wordpress engine because it already had the simplexml parsers.
I also implement a working examples in this post.
The code may not be executing because its a php and you haven’t yet install the Exec-PHP
http://wordpress.org/extend/plugins/exec-php/
October 11th, 2009 at 12:32 am
@amitbhawani No need to upload any external files in #wordpress, already had the simplexml parsers. Rest comments >> http://bit.ly/QW6Zv
October 11th, 2009 at 10:45 am
Good to see that you wrote a detailed post to help one of your reader.
Appreciate it
@djain1989
.-= Deepak Jain´s last blog ..Bolt Browser comes out of Beta, gets Better! =-.
October 14th, 2009 at 9:00 am
Thanks this is working, will post a tweet when the site is up with all the feeds stuff
.-= Amit Bhawani´s last blog ..WordPress Blog Backup Plugins Tools & Tutorials =-.
October 14th, 2009 at 9:26 am
Yours Welcome Amit !
There is lot more customizations possible with xml feeds. For example we can auto fetch the images, thumbs and etc.
Working examples are at the home page of http://www.honeytechblog.com/
October 23rd, 2009 at 6:47 pm
I’ve been looking for something like this to implement on WP blogs.
Thanks for posting this code!
.-= Bryan – After5PC´s last blog ..Why Outsource? When Hiring a Web Designer or Programmer is Good For You =-.
May 21st, 2010 at 12:06 am
RSS Feeds are really very helpful and you could get site and news updates from it.–,
May 26th, 2010 at 1:36 pm
Feedburner is really very useful for syndicating feeds from other websites.*`-
June 1st, 2010 at 2:41 pm
RSS feeds plays an important role for a website and you made it very clear with the step by step installation procedure. Well done.
June 26th, 2010 at 9:58 pm
I’d search tried and delete several options. Till I found this one. works (almost) instantly!
TX!!
July 19th, 2010 at 11:20 am
i always use feedburner to syndicate my blog posts to other subscribers.’*:
July 19th, 2010 at 1:53 pm
i always use feedburner to syndicate my blog posts to other subscribers.–`
August 25th, 2010 at 3:01 am
Hi there,
Thanks for the tut! It works brilliantly. I wanted to know if you could guide me on:
a) How can I make the list bulleted?
b) How can I auto fetch images/thumbnails with xml feed?
Appreciate your guidance.