Connect with us

Tips & Tricks

How to: Display RSS feeds from anywhere

Here is a simple way to display any RSS feed in your WordPress blog.

<?php include_once(ABSPATH . WPINC . '/rss.php');
	$rss = fetch_rss('http://feeds2.feedburner.com/WPCult');
	$items = array_slice($rss->items, 0, 4);

		if (empty($items)) echo '<li>No items</li>';
		else
			foreach ( $items as $item ) : ?>
            <a style="font-size: 14px;" href='<?php echo $item['link']; ?>' title='<?php echo $item['title']; ?>'><?php echo $item['title']; ?></a><br /> 
            <p style="font-size: 10px; color: #aaa;"><?php echo date('F, j Y',strtotime($item['pubdate'])); ?></p>
            <p><?php echo substr($item['summary'],0,strpos($item['summary'], "This is a post from")); ?></p>
            <?php endforeach; ?>

The first step is to include the WordPress file rss.php then will apply code after to style the feeds.

Of coarse I forgot to mention, change the RSS feed to the feed you want to pull.

5 Comments

5 Comments

  1. Septian

    March 24, 2009 at 12:56 am

    Wow, actually I want to ask you how to do that…but, you already answer it with this post 🙂
    anyway, I’ve question for you, please look at your mailbox and answer it ASAP..thx very much…

  2. Peter

    March 26, 2009 at 7:23 am

    Very cool – I had no idea this functionality was built in. I see quite a few projects where people want this type of thing built, and I had assumed you’d have to build your own parser.

    Does anybody know how long Magpie has been in wordpress? This could have saved me lots of time..

  3. Larry

    April 8, 2009 at 9:29 pm

    Thanks but I need some more direction The code you have listed- where do I put that? In the post or page? Appreciate your time

  4. Thanks, this information is usefull..

  5. Raymond Ramy

    April 14, 2009 at 7:01 pm

    ..hey.. I think the “summary” is not functioning..

    Raymond Ramy´s last blog post..Why Choose Freelance Web Designer?

You must be logged in to post a comment Login

Random Search Terms

Title

Top Articles

powered by WassUp

Recent Posts: Fully Net Worth . com

Linda Fairstein Net Worth- How Rich is Linda Fairstein Actually?

Linda Fairstein Net Worth- How Rich is Linda Fairstein Actually?

Linda Fairstein is an American author and former prosecutor. She was the head of the sex crimes of the Manhattan District Attorney’s office from 1976 to 2002. As of 2019, Linda Fairstein net worth is estimated to be $12 million. Born on May 5, 1947, in New York, Linda attended Vassar College where she received […]

Hunter Biden Net Worth: How Rich is Joe Biden’s Son Actually?

Hunter Biden Net Worth: How Rich is Joe Biden’s Son Actually?

Robert Hunter Biden is an American lawyer and lobbyist. He is the son of former U.S. Vice President Joe Biden. He was recently accused by President Donald Trump over being protected from a Ukrainian prosecutor but those claims have been shown to be false. As of 2019, Hunter Biden’s net worth is estimated to be […]

Don Toliver Net Worth: How Rich is the Rapper in 2019?

Don Toliver Net Worth: How Rich is the Rapper in 2019?

Caleb Zackery Toliver, who is better known by his stage name as Don Toliver, is an American rapper and songwriter. He gained a big following after rapping a killer verse on Travis Scott’s single called “Can’t Say” in his much sought after album called Astroworld that released in 2018. As of 2019, Don Toliver net […]

%d bloggers like this: