WordPress.org

Ready to get started?Download WordPress

Forums

fetch_feed not working (7 posts)

  1. brandnewaquarium
    Member
    Posted 4 years ago #

    Well, I used the recommended code etc in order to pull my twitter feed; this is the code:

    <?php // Get RSS Feed(s)
    include_once(ABSPATH.WPINC.'/feed.php');
    
    // Get a SimplePie feed object from the specified feed source.
    $rss = fetch_feed('http://twitter.com/statuses/user_timeline/2893631.rss');
    
    // Figure out how many total items there are, but limit it to 3.
    $maxitems = $rss->get_item_quantity(3); 
    
    // Build an array of all the items, starting with element 0 (first element).
    $rss_items = $rss->get_items(0, $maxitems);
    ?>
    
    <ul>
        <?php if ($maxitems == 0) echo '<li>No items.</li>';
        else
        // Loop through each feed item and display each item as a hyperlink.
        foreach ( $rss_items as $item ) : ?>
        <li>
            <a href='<?php echo $item->get_permalink(); ?>'
            title='<?php echo 'Posted '.$item->get_date('j F Y | g:i a'); ?>'>
            <?php echo $item->get_title(); ?></a>
        </li>
        <?php endforeach; ?>
    </ul>

    It stops and just says "No items." And trust me, that feed definitely has new items every day!

    The web page is http://riverscapewebstudios.com and I"m running 2.9.1 - so my question is, is there something I'm doing wrong?

  2. brandnewaquarium
    Member
    Posted 4 years ago #

    The only thing I can think of is that it's pulling a Twitter feed; however, I tried it with other feeds, and it still didn't work :|

  3. brandnewaquarium
    Member
    Posted 4 years ago #

    Other nuances: I am running the same theme locally, and live. Locally the RSS actually *does* work, but live it does *not*.

  4. WPChina
    Member
    Posted 4 years ago #

    See my post here too, as I am also having issues with this. My problems are the same actually -- I can not get any info from other WordPress blogs using RSS2.0, so I want to make the "No items" work. The "No items" does not work for me, but it seems to work for you?

  5. WPChina
    Member
    Posted 4 years ago #

    I still have this similar problem... does anyone else have this problem or a solution?

  6. lunamedia
    Member
    Posted 4 years ago #

    Hi, had exact same problem; feed working locally on MAMP, not live. Seems to have been fixed by switching

    http://www.example.com/rss2.php

    instead of

    http://www.example.com/feed

    Shouldn't work but it does for me... would like to know the real story behind what's up here though...

  7. paperboy
    Member
    Posted 4 years ago #

    I'm using the same code too but don't get my public Twitter feed to show up.. I don't even get the "No items". :(

Topic Closed

This topic has been closed to new replies.

About this Topic