plugin-icon

Fetch Feed

제작자: JR Tashjian·
Fetches an RSS feed and returns RSS as array
버전
1.5
활성화된 설치 항목
10
최근 업데이트일
Aug 11, 2009

This plugin was created to retrieve and cache an RSS feed for use in a template.

What you do is pass the url to the feed you would like returned and the number of minutes you would like the feed cached for. The plugin will cache the RSS xml and return the feed as an object which you can loop through and output however you please.

New As Of Version 1.5: – Fixed a typo that caused the feed to be retrieved and cached every time. Credit: Binny V A (http://www.bin-co.com/blog/) – Thanks man!

General Usage

fetch_feed_cache() is the only function you will be using with this plugin. fetch_feed_cache() accepts 2 parameters.

  1. (string) $url – This is the URL to the feed you would like to parse
  2. (int) $cache_min – This is the amount of time in minutes you would like the feed cached for.

Here is an example of the plugin being used in a template:

<?php $xml = fetch_feed_cache("http://jrtashjian.com/feed/", 60); ?> <h3><?=$xml->channel->title?></h3> <ul> <?php if( ! empty($xml)) : ?> <?php foreach($xml->channel->item as $item) : ?> <li><a href="<?=$item->link?>"><?=$item->title?></a></li> <?php endforeach; ?> <?php else : ?> <p>Delicious doesn't seem to be working at the moment...</p> <?php endif; ?> </ul>

Remeber, every feed could be different. If you need to see the structure of the object returned just use print_r(). Example: <?php print_r(fetch_feed_cache("http://jrtashjian.com/feed/", 25)); ?>

무료Business 요금제에서
설치하면 WordPress.com 서비스 약관서드파티 플러그인 약관에 동의하게 됩니다.
테스트된 버전
WordPress 2.8
이 플러그인은 다운로드할 수 있으며 에서 사용할 수 있습니다.