Why doesn't Twitter widget work?


#1

I am developing a site based on the ‘Wisdom of Life’ theme for WordPress. The theme comes with a widget to display the user’s Twitter feed, but it is not working properly. I am not familiar with the developing aspect of Twitter and am hoping someone could offer me some direction. Here is the function being used by the widget to fetch the user’s tweets:

//function fetching feed from twitter
function fetch_tweets($url, $num = 1)
{
include_once(ABSPATH . WPINC . ‘/feed.php’);
$url = stristr($url, ‘twitter.com’) ? $url : ‘http://www.twitter.com/’.$url;
$rss = fetch_feed($url);
if(is_wp_error($rss))
{
echo ‘Link Error’ ;
return;
}

	$rss->set_timeout(120);
	$maxitems = $rss->get_item_quantity($num);
	$rss_items = $rss->get_items(0, $maxitems);
	
	if($maxitems == 0) echo '<p>No items.</p>';
	else
	{
		$i = 1;
		foreach($rss_items as $item)
		{
			$title = explode(':', $item->get_title());
			echo '<li><div class="desc"><a href="'.$item->get_permalink().'" rel="nofollow" target="_blank" class="colr"> '.ucwords($title[0]).'</a> '.character_limiter($title[1], 80).' </div>
					<p>'.$item->get_date().'</p></li>';
			if($i == $num) break;
			$i++;
		}
	}
}

#2

This is code that leverages an outdated and retired version of the API. Take a look at [node:10248] for a replacement option.


#3