Displaying an RSS feed in Omeka

You can display any RSS feed in Omeka using Zend RSS, which is packaged with each Omeka installation. Just add the function below to your custom.php file and call deco_display_rss() anywhere you like (homepage, simple pages, etc). Feel free to remove the 'deco' part and use the name of your own theme to keep track of your theme functions...

// this function uses Zend RSS to fetch and display an RSS feed
// example usage, to display one post from omeka.org --> echo deco_display_rss(1,'http://omeka.org/feed/')
function deco_display_rss($num=3, $feed_url){
    $posts = 1;
    $channel = new Zend_Feed_Rss($feed_url);
    foreach ($channel as $item){
        echo '<p><a href="'. $item->link() .'">'. $item->title() . '</a><br/>'.$item->description().' <a href="'. $item->link() .'"> ...more </a></p>';
        if ($posts > $num) break;

I'm sure this can be improved. Right now, it definitely slows down page load times while fetching the feed, and I'm not sure if "breaking" at the end is the best way to end the function. Also, there is no error handling in this function, so be sure to test the feed first and make sure it's not going to become unavailable.

Anyway, hopefully this will be helpful to someone. Might make a nice addition to future versions of Omeka.

Thanks for posting this. I particularly like how this uses a feature of Zend Framework, which of course is included with Omeka.

I've made some minor edits to the code block above to make it show up a little better on the forums, and I've moved this post to the "Themes and Public Display" forum.

Here's a slightly revised version of your function:

function display_feed($feedUrl, $num = 3) {
    try {
        $feed = Zend_Feed_Reader::import($feedUrl);
    } catch (Zend_Feed_Exception $e) {
        echo '<p>Feed not available.</p>';

    $posts = 0;
    foreach ($feed as $entry) {
        if (++$posts > $num) break;
        $title = $entry->getTitle();
        $link = $entry->getLink();
        $description = $entry->getDescription();
        echo "<p><a href=\"$link\">$title</a></p>"
           . "<p>$description <a href=\"$link\">...more</a></p>";

The differences (and rationales):

  • I've reversed the order of the $num and $feedUrl arguments, since $num has a default value. Putting it last means you can simply omit the $num argument if you want the default 3 items.
  • This uses a slightly newer Zend component, Zend_Feed_Reader. The main benefit is that the same code can support RSS, Atom, and other feed types.
  • The code now tests to see if the feed reader was created successfully, and just prints a "not available" paragraph if not.

Perfect. Thanks, John.

Is this solution still relevant to Omeka 2x?

And I don't find a custom.php file inside any of my themes. Am I supposed to create this?

Just from eyeballing it, I suspect it should still work. Also pretty sure you create custom.php.

Would this work if I wanted to create an RSS feed for each of the collections on an omeka site?

I wanted a way for our users to subscribe to collections that they are interested and be updated when new items are added to that collection.


Your question is the reverse of what's above -- you're looking for a feed out, where the above is talking about displaying a feed within Omeka.

That said, Omeka has feeds of items available. For a feed of items from collection 1, just use a url like this:


The above mentioned URL is a system generated URL, right?
How can I get a custom URL like that?

There's not really a handy way to customize the url.

I'm back on this functionality, but feel like a dunce:

a) Where John's script do I add the actual RSS feed URL? I see all the variables for $feed and $feedurl, but I can't tell where I'm supposed to define the feel URL.

b) This goes in custom.php (recommended). How do I output it to my home page?

Thanks! You guys are ALWAYS so helpful, and I try to learn from each example you give me.

Also, this is very odd. But, adding the above script to a custom.php file at my theme root causes my Geolocation/Browse view to quit working....the view shows up (with a map), but all of my Pins nd my list of Items on the Map disappear. http://familyhistory.cjroots.com/geolocation/map/browse/

I tested by removing custom.php, and adding it back in. This is definitely the problem.

I put custom.php at theme root from the recommendation at this blog post (http://www.scholarslab.org/research-and-development/displaying-recent-neatline-exhibits-on-your-omeka-home-page/). Is the theme root the correct spot for custom.php?

Should I create a second forum topic to report this issue? Or does it pertain specifically to the RSS script?