WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Fetch feeds? Simplepie integration? (7 posts)

  1. elcarpo
    Member
    Posted 4 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

  2. Mark / t31os
    Moderator
    Posted 4 years ago #

    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?

  3. elcarpo
    Member
    Posted 4 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...

  4. Mark / t31os
    Moderator
    Posted 4 years ago #

    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)..

  5. elcarpo
    Member
    Posted 4 years ago #

    just changed the rss URL to the feedburner rss URL and now it is working...

    thanks for your help!!

  6. Joel
    Member
    Posted 4 years ago #

  7. Mark / t31os
    Moderator
    Posted 4 years ago #

Topic Closed

This topic has been closed to new replies.

About this Topic