WordPress 中文文档

Function Reference/wp rss

From WordPress Chinese

Jump to: navigation, search

目录

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

Template:Parameter Template:Parameter

Output

The output will look like the following:

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

%%%

Related

fetch_rss

用户