-1

On the home page of my site, I have a content slider which features my most recent Tweet. Lately I've noticed that instead of showing the Tweet, it simply shows "No items." Wondering why this has happened and how to repair?

<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(); ?>'>
<?php echo $item->get_title(); ?>
</a>
</li>
<?php endforeach; ?>
</ul> 

include_once(ABSPATH . WPINC . '/feed.php');
    $rss = fetch_feed('https://api.twitter.com/1/statuses/user_timeline.rss?screen_name=frshstudio');

    if( ! is_wp_error( $rss ) ) {
    $maxitems = $rss->get_item_quantity(1);
    $rss_items = $rss->get_items(0, $maxitems);
    }
    ?>
AMC
  • 1,603
  • 11
  • 43
  • 74
  • other than your `$rss_items` being defined AFTER you try to output it, the code looks ok. Have you tried hitting that url manually in a browser to see what's returned? done a `var_dump($rss)` to see what PHP's getting back? – Marc B Jul 18 '13 at 14:53

1 Answers1

2

The Twitter V1 API is no longer active, as such you will need to modify your app to use the V1.1 api which is documented at https://dev.twitter.com/docs/api/1.1

A big difference is that requests are no longer throttled by IP but by API key

ashryalls
  • 308
  • 2
  • 5
  • I figured there was an update somewhere along the line. I did not write this code myself, what items should I look to change? – AMC Jul 18 '13 at 15:45
  • https://dev.twitter.com/blog/changes-coming-to-twitter-api details some of the big changes, really the biggest hurdle will be moving over to oAuth and authenticating for each request. Personally I just used the library available at https://github.com/abraham/twitteroauth however there are some bits which are not especially well written so if you have the time you may wish to roll your own. – ashryalls Jul 18 '13 at 16:16