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 trackbackfrom your own site.
Subscribe to our FREE Rss FeedWhat's Hot
Similar Interesting Posts
- 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 redirect wordpress.com blog to self hosted domain
- How to display Tag Clouds without using any Wordpress Plugins
- Top 25 twitter tools for Wordpress
- Top 20 wordpress plugins that you can’t miss
- How to check Broken Links of Wordpress Blogs
- Top 40 Featured WordPress Video Tutorials
- Wordpress 2.6.2 Released, How and Why to Upgrade it now?
- How to make a Killer Blog
- How to use multi tabbed menu in wordpress
- Create RSS feeds OPML files with OPMLBuilder
- How to add poll in your blog
- How to auto add excerpt in the wordpress blog home page
Tutorials On









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