All pastes #117998 Raw Copy code Copy link Edit

WP RSS

public unlisted text v1 · immutable
#117998 ·published 2006-08-06 04:56 UTC
rendered paste body
<?php 
require('pathtoyourwordpressinstall/wp-config.php');

require_once (ABSPATH . WPINC . '/rss-functions.php');

// change this to whatever feed you want displayed
$rss = @fetch_rss('http://planet.wordpress.org/feed/');

if ( isset($rss->items) && 0 != count($rss->items) ) {

// change this to whatever you want it titled
?>
<h3><?php _e('Other WordPress News'); ?> <a href="`http://planet.wordpress.org/`"><?php _e('more'); ?></a></h3>

<ul>
<?php
// change the number "20" to the number of items you want displayed
$rss->items = array_slice($rss->items, 0, 20);

foreach ($rss->items as $item ) {
?>
<li><a href='<?php echo wp_filter_kses($item['link']); ?>'><?php echo wp_specialchars($item['title']); ?></a></li>
<?php
}
?>
</ul>

<?php
}
?>