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'
),
$attrs
);
// 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="https://wordpress.stackexchange.com/questions/99584/%1$s">%2$s</a>',
esc_url( strip_tags( $item->get_link() ) ),
$title
);
}
return '<ul class="feed-list"><li>' . join( '</li><li>', $lis ) . '</ul>';
}