Categories: 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.

Web Master

Hi, I am Miguel, I bought this site in 2009. So I now run or manage the site. Please visit my new website or follow me on twitter @W3i.

Recent Posts

Jon Asked: How to add thumbnails above post on the THiCK theme

I was asked by a reader: I'm using the THiCK theme for my new design…

1 hour ago

13 Best WordPress Email Marketing Plugins

The article lists the 13 best WordPress email marketing plugins for 2022 - HubSpot, ConvertKit,…

13 hours ago

AI Chips in 2024: Navigating NVIDIA’s Dominance and Emerging Competitors

In 2024, NVIDIA remains a dominant force in the AI chip market with its innovative…

1 day ago

21 Best ChatGPT Prompts for Marketing and How to Utilize Them Effectively

In the rapidly evolving realm of digital marketing, ChatGPT has emerged as an invaluable tool,…

2 days ago

WP Cult attending WordCamp Denver 2009

It is official, today I purchased my ticket for WordCamp Denver! I as well as…

2 days ago

Navigating the AI Revolution: 7 Key Challenges for Web Professionals

AI's Transformative Impact on Web Professionals Artificial intelligence (AI) is revolutionizing the digital landscape, and…

3 days ago