Latest News in Magento

You would like to have a eCommerce power of Magento, but also have a blog to empower your business? In this case, you probably know that Magento doesn’t have some article manager in the box. Many clients seek for supplementary solution like WordPress to accomplish this goal. Ok, so you created a blog on same or different domain and you would like those articles to appear somewhere in Magento (probably sidebar). This article will explain how to do it.

Step 1

Let’s create a file called latest_news.phtml in app/design/frontend/default/[your_theme]/template/callouts/latest_news.phtml
Now we will create a PHP block that will display the list of articles from RSS feed. We will use Inchoo RSS for demonstration purposes. In your scenario, replace it with your own valid RSS URL.

< ?php $channel = new Zend_Feed_Rss(''); ?>
<div class="block block-latest-news">
<div class="block-title">
<h2>< ?php echo $this->__('Latest News') ?></h2>
<div class="block-content">
<ol id="graybox-latest-news">
< ?php foreach ($channel as $item): ?>
<li><a href="<?php echo $item->link; ?>">< ?php echo $item->title; ?></a></li>
< ?php endforeach; ?>

Step 2
Now, we should decide where to place it. I assume you already know how Magento blocks and references work. Let’s assume you would like to place it in right column by default for whole catalog. In this case open your app/design/frontend/default/[your_theme]/layout/catalog.xml file and under “default” tag update “right” reference with something similar.

<reference name="right">
<block type="core/template" name="" as="topSearch" template="catalogsearch/"/>
<block type="core/template" name="right.permanent.callout" template="callouts/right_col.phtml"/>
<block type="core/template" name="" template="callouts/latest_news.phtml"/>

That’s it. You should be able to see the list of articles from RSS feed with the URLs. Hope this will help someone.

You made it all the way down here so you must have enjoyed this post! You may also like:

PHP 7 and Magento – a quick overview Ivona Namjesnik
Ivona Namjesnik, | 2

PHP 7 and Magento – a quick overview

Using Redis cache backend and session storage in Magento Marko Martinovic
Marko Martinovic, | 43

Using Redis cache backend and session storage in Magento

Consuming Magento REST service using Zend_OAuth_Consumer Darko Goles
Darko Goles, | 45

Consuming Magento REST service using Zend_OAuth_Consumer


  1. Hi,
    very userful post, just one question: is there a way to set timeout? default is 10 seconds but I’d like to decrease it to 4. I tried new Zend_Feed_Rss(‘’, array(‘timeout’ => 4)); but it’s not working, debug still says “timed out after 10 seconds”

  2. How can we use “_buildEntryCache” method along with Zend_Feed_Rss for better performance??
    is there any alternate way to cache result for X time?

  3. Will this go into cache of the system?
    Do I need to do something to cache it?
    Because if each hit It reloads the feed it will be quite a load…


  4. Thanks. I`m a newb at magento but i managed to get it to work in the sidebar on all pages.
    Limited to 3 articles tho and 100 characters so it wont get big :d
    thanks again

  5. When i include this code.. home page content disappears .. and when i remove this code (specially 1st line) it shows back..

  6. Also you need to do a find and replace and change all [ to to ]

    Also would just like to say this site is awesome, I have learnt so much about Magento in such a short space of time and most of that knowledge has come from this site.
    Keep up the good work.

  7. Just went through the whole post, Thank you to all who contributed. This made it a lot easer for a classic asp dev like me.
    just thought i would make this easer for every new viewer.

    [?php $channel = new Zend_Feed_Rss(''); ?]
    [div id="rss-block-container"]
    [div class="rss-block-title"]
    [h2][?php echo $this-]__('Latest News') ?][/h2]
    [div id="rss-content"]
    [ol id="rss-content"]
    [?php $counter = 0; ?]
    [?php foreach ($channel as $item): ?]
    [li id="rss-content"][p][strong][a href="[?php echo $item-]link; ?]"][?php echo $item-]title; ?][/a][/strong][/p][?php echo substr($item-]description,0,150); ?]....[p][strong][a href="[?php echo $item-]link; ?]"]Read More[/a][/strong][/p][p][strong][?php echo $item-]pubDate; ?][/strong][/p][/li]
    [?php if(++$counter == 3) {break;}?]
    [?php endforeach; ?]

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <blockquote cite=""> <code> <del datetime=""> <em> <s> <strike> <strong>. You may use following syntax for source code: <pre><code>$current = "Inchoo";</code></pre>.

Tell us about your project

Drop us a line. We'd love to know more about your project.