How to display tweets on a WordPress page

There are a lot of ways to display your tweets on your blog. Many are complicated and ugly. Sometimes, you hit Twitter’s API rate limit. Most require the client to perform additional work. I made a very simple WordPress plugin to handle this.

All you do is stick [get_latest_tweets username="me"] where you want the tweets to go. You can optionally supply a count=X parameter to display more or fewer tweets.

JSON is cached, preventing the Twitter server from being hit more than twice in one minute.

You get markup like this, which you can style as you please:

<ul class='tweets'>
<li>@<a class='atreply' href='http://twitter.com/jane'>jane</a> Please dance a jig. <span class='date'><a href='http://twitter.com/me/status/2345'>3 hours ago</a></span></li>
<li>Anyone used TotalFinder? <a href='http://t.co/blah'>http://t.co/blah</a> Saw it on @<a class='atreply' href='http://twitter.com/bob'>bob</a>'s machine and am intrigued. <span class='date'><a href='http://twitter.com/me/status/1234'>6 hours ago</a></span></li>
</ul>

Grab the plugin from GitHub or the WordPress plugin directory.

Join the Conversation

51 Comments

Leave a comment

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