
Originally Posted by
BinaryMoon
Edward - could you clarify what you mean about the refresh frequency, I think this may be related to a problem we've been having with feeds being cached for longer than intended. I've had a look but can't work out where the cache is stored or how it works. I do caching myself in the theme so any info you can give would be great.
I borrowed heavily from the core files to create the BNS SMF Feeds plugin, specifically code from Code:
../wp-includes/feed.php
and Code:
../wp-includes/default-widgets.php
Inside feed.php you will find the fetch_feed() function ... I modified it like so:
PHP Code:
function bns_fetch_feed($url) {
require_once (ABSPATH . WPINC . '/class-feed.php');
$feed = new SimplePie();
$feed->set_feed_url($url);
$feed->set_cache_class('WP_Feed_Cache');
$feed->set_file_class('WP_SimplePie_File');
$feed->set_cache_duration(apply_filters('wp_feed_cache_transient_lifetime', $feed_refresh));
$feed->init();
$feed->handle_content_type();
if ( $feed->error() )
return new WP_Error('simplepie-error', $feed->error());
return $feed;
}
The user can then set the new $feed_refresh variable in the option panel (instead of the core default of 43200 seconds, or 12 hours); and, although it has not been tested 100%, I would expect the refresh frequency will work at different speeds within each instance of the widget.
The plugin was more about building a SMF Forum specific RSS URL than displaying the feed items ...