Fix for the Twitter Feed in the Aparatus Sidebar

Published: Oct 14, 2012

Several users had mentioned that the Aparatus sidebar tweet has stopped working. I investigated and it turns out that it had something to do with Twitter, it’s API versions conflicting of some sort. I revised some of the code and the results are below.

Update 9-2013 – Twitter now require an API key for this functionality so the code below will no longer work. Aparatus theme have been updated to not include this in the sidebar.

Note that this will require you to edit the code – so you have to open sidebar.php in the editor in the admin section.

The old code also makes use of the snoopy class – which I thought was overkill since we’re only grabbing the latest tweet. I have taken out a few unnecessary loops, and calls to update options and such. Look for this block of code in sidebar.php:


fetch($url); if ($result) { $twitterdata = json_decode($snoopy->results,true); $i = 0; while ($twitterdata[$i]['in_reply_to_user_id'] != '') { $i++; } $pattern = '/@([a-zA-Z]+)/'; $replace = '@1'; $output = preg_replace($pattern,$replace,$twitterdata[$i]["text"]); $output = make_clickable($output); $tweet['lastcheck'] = mktime(); $tweet['data'] = $output; $tweet['rawdata'] = $twitterdata; $tweet['followers'] = $twitterdata[0]['user']['followers_count']; update_option('lasttweet',$tweet); } else { echo "Twitter API not responding."; } } else { $output = $tweet['data']; } echo "

".$output."

"; ?>

And replace with the code below:


Twitter is not responding.

"; }else{ $twitterdata = json_decode($json, true); $pattern = '/@([a-zA-Z]+)/'; $replace = '@1'; $output = preg_replace($pattern,$replace,$twitterdata[0]["text"]); $output = make_clickable($output); echo '

' . $output . '

'; } ?>

First thing you’ll see is the twitter url has changed. Followed by a leaner, cleaner output. Note that I will include this the next version of Aparatus so stay tuned.

Did you know you can Write for us?

Check out our Guest Post Guidelines to see what it takes.

Submit an Article

11 thoughts on “Fix for the Twitter Feed in the Aparatus Sidebar

    Owen says:

    I’ve just updated to the code above as well but am still having the same problem with ‘Twitter is not responding’ being displayed. Is there a fix to this yet?

    Twitter has changed their api once again. I haven’t had a chance to look into it. I will post an update

    Owen says:

    Hi Michael, any update?

    Twitter now requires an api key for this functionality so i had to disable.

    Anthony Adornato says:

    I frequently get “Twitter is not responding” on the Apparatus theme.I changed out the code above, but still no luck. Also, any handle, such as @CNN, shows up at @1. What’s the fix?

    Thank you for the update. For me, WordPress is not saving the , only the / in the code. I’ve tried this in both Chrome and Safari. It saves it without the , so I think that’s why it’s not showing up right in mine. Is there a way to disable @ replies and only show non-reply tweets?
    Thank you.

    Sorry about that, giving the same “Twitter is not responding.” on single posts now too. Hopefully it’s on their end. 🙂

    Thank you for the update. For me, WordPress is not saving the , only the / in the code. I’ve tried this in both Chrome and Safari. It saves it without the , so I think that’s why it’s not showing up right in mine. Is there a way to disable @ replies and only show non-reply tweets?
    Thank you.

    yes – but will need to modify the twitter feed.

    That works great on single post pages, but still gives a “Twitter is not responding.” message on the front page. Still, this is better than a blank area. Thanks!

    Eric says:

    Cool, thanks. That did the trick alright!

Comments are closed.