Twitter Display Code No Longer Working


I have a code which displays the Tweets from my Twitter profiles however they have stopped working. I had the same code working on another site and this has also stopped working.

	 <script src="" type="text/javascript">

<script src="" type="text/javascript">



I discovered exactly the same problem on one of my sites yesterday. It’s because Twitter retired version 1 of their API on Tuesday. Now all requests have to be made via version 1.1 of the API, which unfortunately requires authentication now for all requests.

At this point, you have two options really… you can use one of the timeline widgets that Twitter provide (the easiest option), or you’ll need to set up some server side code (ie. PHP or similar) to do the API authentication.


How do I find the Twitter widgets. But personally I think they are messy.

Is there are a replacement for the code they retired?

Hi Justlukeyou - login to Twitter then go to to manage and create new widgets.


I have looked from through them. Are there any minimalist widgets? The Twitter ones look clunky and overbearing.

Sorry, probably can’t help you too much further - there’s this link - which gives an overview of the new set up.

Just to make sure we’re on the right wave length, the following code would be for my site - is this the same code you feel is too “clunky”:

<a class=“twitter-timeline” href=“” data-widget-id=“345256637520551936”>Tweets by @Easy_Bingo</a>
<script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?‘http’:‘https’;if(!d.getElementById(id)){js=d.createElement(s);;js.src=p+“://”;fjs.parentNode.insertBefore(js,fjs);}}(document,“script”,“twitter-wjs”);</script>

if you do find an answer to this, let me know, i would also be interested to hear this.

Twitter has turned off their old API - to use the new one, you must go to the twitter development site and create an app for your account. This is give you the keys you need to perform Oauth.

Once you have them, you can access your tweets via PHP - here is the code I use to read my tweets and store them in a MySQL table for future processing.

You will need to download the twitteroauth.php library for this to work.

$twitter_un = “Your-Account_Name”;
$num_tweets = 10;
$consumerkey = “xxxxxxxxxxxxxxx”;
$consumersecret = “xxxxxxxxxxxxxxxxxxxxxxxxx”;
$accesstoken = “xxxxxxxxxxxxxxxxxxxxxxxxx”;
$accesstokensecret = “xxxxxxxxxxxxxxxxxxxxxxxx”;
$connection = new TwitterOAuth($consumerkey, $consumersecret, $accesstoken, $accesstokensecret);
$tweets = $connection->get(““.$twitter_un.”&count=”.$num_tweets);
$dbconn=@mysql_connect(“localhost”,“username”,“password”) or die(mysql_error());
foreach($tweets as $tweet) {
$entry = $tweet->text;
$entry = addslashes(trim(substr($entry, 0, 300)));
$sql = “SELECT * FROM twitterfeed WHERE tweet=‘$entry’”;
$result = @mysql_query($sql) or die(mysql_error());
$rr = mysql_num_rows($result);
if ($rr == 0)
$sql = “INSERT INTO twitterfeed(tweet) VALUES(‘$entry’)”;
$results = @mysql_query($sql);

I can’t customize the widget. Is there a way to customize it? It’s ugly white or dark background? wtf?