WordPress.org

Ready to get started?Download WordPress

Codex

Attention Interested in functions, hooks, classes, or methods? Check out the new WordPress Code Reference!

Difference between revisions of "Function Reference/wp rss"

(changes to proper / new filename)
(Using Parameter template)
Line 21: Line 21:
   
 
==Parameters==
 
==Parameters==
+
{{Parameter|$uri|URI|The URI of the RSS feed you want to retrieve. The resulting parsed feed is returned, with the more interesting and useful bits in the items array.}}
; <tt>$uri</tt> : (''URI'') The URI of the RSS feed you want to retrieve. The resulting parsed feed is returned, with the more interesting and useful bits in the items array.
+
{{Parameter|$num|integer|The number of items to display.}}
; <tt>$num</tt> : (''Number of items'') The number of items to display.
 
 
[[Category:Functions]]
 
[[Category:Functions]]
   

Revision as of 02:49, 13 January 2008

Description

Retrieves an RSS feed and parses it, then displays it as an unordered list of links. Uses the MagpieRSS and RSSCache functions for parsing and automatic caching and the Snoopy HTTP client for the actual retrieval.

Usage

<?php
include_once(ABSPATH WPINC '/rss-functions.php');
wp_rss($uri$num);
?> 

Example

To get and display a list of 5 links from an existing RSS feed:

<?php 
include_once(ABSPATH WPINC '/rss-functions.php');
wp_rss('http://example.com/rss/feed/goes/here'5);
?>

Parameters

$uri
(URI) (required) The URI of the RSS feed you want to retrieve. The resulting parsed feed is returned, with the more interesting and useful bits in the items array.
Default: None
$num
(integer) (required) The number of items to display.
Default: None

Output

The output will look like the following:

<ul>
<li>
<a href='LINK FROM FEED' title='DESCRIPTION FROM FEED'>TITLE FROM FEED</a><br />
</li>
(repeat for number of links specified)
</ul>

Related

fetch_rss