Recently, Twitter made some changes and dropped support for RSS (as well as imposing plenty of other measures and limitations along the way). You can read about it here – http://mashable.com/2012/09/05/twitter-api-rss/
A while back, I shared some code on How to get a Twitter feed into your WordPress theme. These new changes to Twitter’s API mean that this method no longer works. So, I’ve updated it.
I’ve also moved it into a Class. This needs updating already, as the JSON API actually gives us access to all sorts of new things, but this should be a good starting point.
// Twitter Class
// Usage:
// $twitter = new Twitter;
// $twitter->twitter_messages();
class Twitter{
function __construct() {
$this->Twitter();
}
function Twitter(){
define('MAGPIE_CACHE_ON', 1); //2.7 Cache Bug
define('MAGPIE_CACHE_AGE', 1800);
define('MAGPIE_INPUT_ENCODING', 'UTF-8');
define('MAGPIE_OUTPUT_ENCODING', 'UTF-8');
}
public function twitter_messages($username = 'douglasradburn', $amount = 5, $error = 'Unable to retrieve tweets at this time.')
{
try {
$feedDetails = $this->curlGet('https://api.twitter.com/1/statuses/user_timeline.json?include_entities=true&include_rts=true&screen_name=' . $username . '&&count=' . $amount);
$feed = json_decode($feedDetails);
$i=0;
foreach($feed as $item){
printf('Image Credit: Ian Sane
Pingback: Scion Players | A Wordpress Twitter stream, without the RSS… | Web Development …