Blog -

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 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.



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.

6 responses to “Display latest tweets using Twitter’s new API”

  1. Stephen says:

    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.


    • Dijitul says:

      Hey Steve

      Yeah you can.

      If you wrap this bit

      if (tweets[n].innerHTML) {
            html += '
    • ' + tweets[n].innerHTML + '
    • '; } else { html += '
    • ' + tweets[n].textContent + '
    • '; }

      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.

      Hope that helps

  2. Iulian says:

    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.

  3. Jamie says:

    Excellent solution. Is there an easy way to add the date the tweet was posted? Thanks!


Leave a Reply

Your email address will not be published. Required fields are marked *