Display latest tweets using Twitter’s new API
So we’ve come up against a stumbling block this week due to Twitter changing its API.
You might have seen (if you’re a website owner or developer) that your widgets displaying your latest tweets have stopped working this week. On the dijitul.uk website we had a nice widget displaying our latest tweets and also displaying working links that users could click on but with Twitter deprecating version one of their API this week it broke.
We hunted around for a few solutions and didn’t manage to find anything that would suit us; we didn’t want anything too complex and heavy.
Eventually we came across a cool workaround by Jason Mayes who had found a way to take a standard twitter widget and use it to display an unformatted list of an accounts latest tweets. As we started implementing it we realised we only wanted to display the latest tweet and also include a clickable link.
So we forked Jason’s fix and amended it to work for us. If you’re looking for a way to include the latest tweet on your website with a clickable link check this link out below.
Display latest tweet using Twitter’s new API
N.B: Thanks for Jason for the original fix.
Update:
We also found this morning that you can take an Standard Twitter widget and edit the the css using an adaptation of the solution we worked on earlier. Currently on a Twitter Widget you CANNOT override the css regardless of what you do. This new way allows you to fully control the styling of an existing widget.
This is great.
Is there any way to adjust the number of tweets pulled and shown? By deault, it only pulls one, but I need 3.
Cheers
Steve
Hey Steve
Yeah you can.
If you wrap this bit
in a foreach loop with a counter it’ll just display as many as you want.
Jason’s reworked his original jsfiddle to let you play with the number of tweets. It’s here. http://jsfiddle.net/jmayes/maT2Z/
Hope that helps
Awesome solution, one question though: is there a chance of being banned by Twitter? I used a Wp plugin last time and my acc was suspended.
Hi Lulian
No, there’s no chance of acct suspension as this solution just uses twitter own inbuilt system.
Excellent solution. Is there an easy way to add the date the tweet was posted? Thanks!
Jamie
Hey Jamie
The date should be shown already