Archiving Twitter With WordPress

Yesterday I had a spare couple hours and decided to follow Doug Bowman’s example and set up a self-hosted archive of my Twitter stream with WordPress. You can see the finished product of that here.

There was some interest expressed on Twitter of others wanting to do something similar so I thought I’d help out by making what I did available for download. You can grab a copy of the theme and required plugins which will provide pretty close to a turn key solution for getting this running.

I highly suggest following Bowman’s tutorial for downloading and importing the initial archive of previous tweets. Once you have that done and the plugins and theme are installed there’s a couple things you’ll want to do:

  • Replace the profile_image.jpg file in the theme folder with your own profile image.
  • Head to your profile page within your WordPress installation. You’ll see two new fields, one for the url of your Twitter profile and the other for your Twitter username. These power the text in the header so just fill them both out and the header text will be linked to your profile.
  • The tagline below the username in the header is pulled from your blog’s tagline so fill that out in General tab underneath Settings.
  • Setup Twitter Tools to create a new blog post every time you tweet. You can find more information about doing that at the WordPress plugin directory.
  • Run two queries using the Search Regex plugin (for more info on these queries read the original source). This will link up all the @usernames and #hashtags from your tweets.
    • For @usernames enter /(^|s)@(w+)/ into the Search Pattern field and then enter 1@<a href="">2</a> into the Replace pattern field. Check the Regex box.
    • For #hashtags enter /(^|s)#(w+)/ into the Search pattern field and then enter 1#<a href="">2</a> into the Replace pattern field. Check the Regex box.
    • In both cases I suggest running a Replace before running Replace & Save. This will allow you to look everything over before making changes that will affect your database.

That’s it. After doing those steps you should have a searchable, self-hosted archive of everything you’ve posted on Twitter. If you run into questions or problems feel free to fire away in the comments.

Update 3/23: Emily Ingram pointed me to a plugin that will achieve the same auto-linking of @replies and #hashtags that the regex calls do. It’s a super simple solution and can be downloaded from the WordPress directory. Sounds like it works quite well.


Andrew Nacin says:

WordPress is actually adding those curly quotes, not your font, via a nifty function call wptexturize(). It won’t add curly quotes inside <code> tags, though.

Andrew says:

Ah, so it is. I had forgotten about wptexturize. Thanks for the tip!

I really wish I had in some way backed up my twitter account before it got hacked. It would have been really smart to backup the data on my server, I’ll try it in the future.

Also, three Andrew’s in a row FTW.

Comments closed