Display RSS Feed using WordPress

Using WordPress we can add RSS feed easily for default WordPress function. Using bellow snippet list of RSS feed.

/*********/
/* Display RSS Feed using WordPress
/*********/

include_once(ABSPATH.WPINC.'/rss.php'); // path to include script
$feed = fetch_rss('feed url'); // specify feed url
$items = array_slice($feed->items, 0, 9); // specify first and last item

foreach ($items as $item):
	?>
    <div class="blog-discription">
    	<div class="blog-meta">
        	<a class="blog-title" href="<?php echo $item['link']; ?>"><?php  echo $item['title'];?></a>
		</div>
        <div class="single-blog-content">
			<?php echo $item['description']; ?>
       	</div>
	</div>
    <?php
endforeach;
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s