wp_rss

Advertisement

Summery Summery

Display all RSS items in a HTML ordered list.

Syntax Syntax

wp_rss( string $url, int $num_items = -1 )

Parameters Parameters

$url

(Required) URL of feed to display. Will not auto sense feed URL.

$num_items

(Optional) Number of items to display, default is all.

Default value: -1

Source Source

File: wp-includes/rss.php

		foreach ( (array) $rss->items as $item ) {
			printf(
				'<li><a href="%1$s" title="%2$s">%3$s</a></li>',
				esc_url( $item['link'] ),
				esc_attr( strip_tags( $item['description'] ) ),
				esc_html( $item['title'] )
			);
		}

		echo '</ul>';
	} else {
		_e( 'An error has occurred, which probably means the feed is down. Try again later.' );
	}
}
endif;

if ( !function_exists('get_rss') ) :
/**
 * Display RSS items in HTML list items.
 *
 * You have to specify which HTML list you want, either ordered or unordered

Advertisement

Changelog Changelog

Changelog
Version Description
1.5.0 Introduced.

Advertisement

Leave a Reply