WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

i'm working on a website that is built on WordPress & the Genesis Framework. I'm looking to display an RSS feed From Feedstich within WordPress pages in the middle of the content. What is my best bet of doing this, is there a plugin that can use shortcodes or is there a way I can use php in pages to display them?

share|improve this question
up vote 1 down vote accepted

You could use a wrapper for fetch_feed() as a simple shortcode.

Very basic example; see the RSS widget code for more options.

<?php # -*- coding: utf-8 -*-
 * Plugin Name: T5 Feed Shortcode
 * Description: Use <code>[feed url="http://wordpress.stackexchange.com/feeds"]</code> to display a list of feed items.

add_shortcode( 'feed', 't5_feed_shortcode' );

function t5_feed_shortcode( $attrs )
    $args = shortcode_atts(
        array (
            'url' => 'http://wordpress.stackexchange.com/feeds'

    // a SimplePie instance
    $feed = fetch_feed( $args[ 'url' ] );

    if ( is_wp_error( $feed ) )
        return 'There was an error';

    if ( ! $feed->get_item_quantity() )
        return 'Feed is down.';

    $lis = array();

    foreach ( $feed->get_items(0, 20) as $item )
        if ( '' === $title = esc_attr( strip_tags( $item->get_title() ) ) )
            $title = __( 'Untitled' );

        $lis[] = sprintf(
            '<a href="%1$s">%2$s</a>',
            esc_url( strip_tags( $item->get_link() ) ),

    return '<ul class="feed-list"><li>' . join( '</li><li>', $lis ) . '</ul>';
share|improve this answer
I think this makes sense, just add these lines of code to my functions file (or a custom plugin) then use the shortcodes? @torscho – Zach Russell May 15 '13 at 19:16
The code is a complete plugin. Install, activate, and it works. Never put a shortcode into a theme. – toscho May 15 '13 at 19:18

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.