elcarpo
Member
Posted 2 years ago #
i use to have this beautiful piece of code to fetch a rss and show it on my site
<?php // Get RSS Feed(s)
include_once(ABSPATH . WPINC . '/rss.php');
$rss = fetch_rss('url to feed');
$maxitems = 10;
$items = array_slice($rss->items, 0, $maxitems);
?>
<ul class="list2">
<?php if (empty($items)) echo '<li>No items</li>';
else
foreach ( $items as $item ) : ?>
<li><a href='<?php echo $item['link']; ?>'
title='<?php echo $item['title']; ?>'>
<?php echo $item['title']; ?>
</a></li>
<?php endforeach; ?>
now it is not working, and on the codex it is mentioned that the function fetch_rss has been deprecated and replaced by fetch_feed
http://codex.wordpress.org/Function_Reference/fetch_rss
http://codex.wordpress.org/Function_Reference/fetch_feed
does anyone knows how do i use the new function?
thanks
That code works for me... i was using it earlier today when testing...
Use the following URL in the above..
http://wordpress.org/support/rss/topic/291550
(Feed for this topic)..
Most certainly does work..
Where are you placing that code?...
What file?
elcarpo
Member
Posted 2 years ago #
i'm placing it at sidebar.php
it was working, but i don't know if it stopped working when i upgraded to wp 2.8.1, or when i changed to another server...
I had trouble earlier myself, then i realised it was because my internet had dropped out...
Other then that i don't have a problem...
2.8.1, 2.8, and 2.7, never had a problem...
For what it's worth i've used the fetch_rss function (fetch_feed is new i think - i'm sure it works to though)..
elcarpo
Member
Posted 2 years ago #
just changed the rss URL to the feedburner rss URL and now it is working...
thanks for your help!!