Current version : 2.0 – compatible with Twitter's OAuth API
If you want to browse your own tweet history, Twitter sucks. If you have published more than 3200 tweets, Twitter lost the older ones. If you want to search a particular tweet about that awesome link you shared, you're toast. You can use #hashtags in your tweets but they won't be of any use to help you organize them. Oh, and those horrible t.co links.
On the other hand, WordPress does all this fine, so I made a plugin to archive all your tweets in WordPress, easily search them, and everything you wish Twitter would do.
Live Example
My tweet archive: Ozh' Tweets (notice the cool stats in the sidebar)
Download
ozh-tweet-archiver.zip
Extract and upload to your blog, preserving directory structure.
Plugin Usage
- Install a fresh new empty blog (a subdirectory of your current blog will be fine, or a tweet.domain.com subdomain, it doesn't matter)
- Install, activate the plugin, follow configuration instructions.
Features, Plugin Configuration
You'll need to create a Twitter application to obtain the consumer and secret keys. That'll be the hardest part.
FAQ
Q: The [whatever] does not work!
A: WorksForMe.
Q: But [Other guy's plugin] does the same and more!
A: Exactly. "And more". I didn't need this.
Q: How are tweets imported?
A: As regular posts, with a few post custom fields (containing tweet source, "in reply to" data, etc). Hashtags can be converted as post tags if you wish (you'll want to do this), t.co links can be expanded to their original URLs, and some proper markup will be applied (see below, developer info)
Q: I tried to import all my tweets for the first time but the page died with an error / timeout / alien abduction !!1
A: Just hit F5 to reload the page. There will be no duplicates.
Q: I have more than 3200 tweets. How do I import & archive the old ones?
A: I wrote an importer script that uses this plugin. If it doesn't work for you, see first question of this FAQ (or write something yourself). The script: https://gist.github.com/ozh/11166845. There is another script with a similar approach, using data from the JSON files instead of the CSV one: https://gist.github.com/ozh/f5deafcffd8d271bfa92
Q: What theme did you use for your Tweet archive?
A: I made a theme for my own needs but it's freely available, feel free to use and hack it to make something for yourself: Ozh' Tweet Archive Theme.
Q: Can you add this or that feature?
A: This plugin was made to fit my needs. But hey, who knows, maybe I'll feel the need for your idea? Head to the Github repository and file a pull request.
Q: That one tweet got weirdly formatted/truncated when imported!
A: There's an "Edit post" link somewhere. That's the beauty of WordPress when compared to Twitter.
Q: Something doesn't work
A: Create a file named debug.log in this plugin's directory. This will activate the debug mode and a lot of things will be logged in that file. See if that helps. If not, see item #1 of this FAQ.
Theme developer stuff
Each tweet will be added some markup and classes, depending on your settings (if you want to link to @mentions, link to #hashtags as tags, etc…) to allow fine styling.
@mentions
When linked to Twitter profiles:
- <span class="username username_linked">@<a href="https://twitter.com/ozh" title="Ozh Richard">ozh</a></span>
Not linked:
- <span title="@ozh" class="username username_unlinked">@ozh</span>
#hashtags
You can elect to link hashtags to Twitter (as Twitter does), as local WordPress tags (much cooler), or to not link them. In each case, the markup for #bleh will be:
When linked to Twitter:
- <span class="hashtag hashtag_twitter">#<a href="https://twitter.com/search?q=#bleh">bleh</a></span>
When locally linked to WordPress tags:
- <span class="hashtag hashtag_local">#<a href="http://yoursite.com/tag/bleh">bleh</a>
Not linked:
- <span class="hashtag hashtag_no">#bleh</span>
Links
Links can be "un-t.co'd" (expanded)
- <a href="http://example.com" title="http://example.com" class="link link_untco">example.com</a>
Or kept as original t.co links:
- <a href="http://t.co/L4m3l1nk" class="link link_tco">http://t.co/L4m3l1nk</a>
Embedded media
If you enable embedding images from pic.twitter.com, you'll get the following:
- <span class="embed_image embed_image_yes"><a href="[image link]"><img src="[image src]" /></a></span>
Template tags
The plugin comes with a bunch of template tags to be used into your theme. Refer to file template_tags.php that comes with the plugin.
Shorter URL
Want to share or tweet this page? Please use this short URL: http://ozh.in/tq
I LOVE this one in the FAQ:
Q: The [whatever] does not work!
A: Worksforme.
Best plugin developer FAQ item ever. :) I'm writing up your plugin tonight. Thanks for your hard work on this one!
I'm loving this plugin. However, I just noted, my Twitter profile says I currently have 998 tweets so far, while my Tweet Archives' edit posts page in the admin area indicates I only have 968 posts so far. It means either the import is short by 30 tweets, or Twitter's count is over by 30.
deuts » yeah I notice the same slight difference with my account. I guess DM's are counted (but not displayed, obviously), or maybe the Twitter API is just wrong :)
Oh, is that it? Anyway, I can leave without those 30 tweets. :D
Great plugin, fantastic idea. I have one problem: for over an hour now the manual archiving page says:
with the seconds counting down from 90 to 0, cycling ad infinitum over those 90 seconds.
Would appreciate any suggestion.
Thanks! Got this running on two accounts now.
Doh! Turns out the FAQ was right, especially the part that Sarah Gooding quotes.
I've been debugging this thing well into the night without result, after which I decided to start from scratch this morning, deactivated and deleted the plugin, reinstalled it again and, voilà, it worked.
I still don't know what happened, but now "Worksformetoo!" :D
I tweaked the theme a bit and my twitter archive looks great. I found one problem in the searchform.php module. My archive sits at the root of the domain oriste.gr (linked under my name). Searchform.php however contains this line:
and returns a 404 in my case. Changing "/tweets/" to "/" solved the problem.
I'd also like to take you up on the invite in the last item of the FAQ. I have way over 3200 tweets (so manually archiving only retrieves those), but I have been saving them all in json format files through backupmytweets.com. It would be neat if there would be a way to load such files as well. Just a suggestion, I'll understand if you don't feel the need for this idea.
I tried it myself by tweaking the code to point $api to a location where my jason file resides (and omitting the optional parameters) but that didn't work. I'm not proficient enough in PHP or the WP framework to do this myself I'm afraid.
Anyway I had a great time so far with your plugin, so thank you for that!
Oops, the code line in the previous post was eaten. Here it is (hopefully):
Giving up, it's the first line in searchform.php
oriste » no surprise here, the theme is full of hardcoded stuff :) About the JSON archive from backupmytweets, can you send me this file? (ozh at ozh dot org) If the JSON structure is the same than the one produced by the API, it could be quite easy to import all tweets from this file.
Import worked okay, but the time stamps are all off. I suspect it has to do with how you're handling GMT (or not). Here's an example from your own site:
3:43pm Sep 24
http://planetozh.com/tweets/3698
10:43 AM Sep 24
http://twitter.com/ozh/status/25415368585
The above two seem to be the same tweet, but the date/time don't match. I believe the twitter API gives you GMT stamps. You could either check the time zone setting in WordPress, or check the time zone setting in the user's twitter profile. Then do the conversion before inserting into the 'posts' table.
Thanks.
Scott Crevier » I'll see what I can do (but I don't really mind to be honest)
OK, I should have first read about setting up a sub-directory before archiving all my tweets after installing the plug-in on my main blog. All tweets now show up there ahead of my blog posts! This is not what I wanted at all…. How can I either delete them or move them to a new sub-directory?
Thanks for your assistance.
Joe
I tried your plugin with WordPress 3.1 and it failed.
Main errors:
Notice: add_option was called with an argument that is deprecated since version 2.3 with no alternative available.
Notice: has_cap was called with an argument that is deprecated since version 2.0!
Warning: Cannot modify header information
Nevermind. It may have been another plugin and I just assumed. My bad.
Seems to be working now. ;)
Is it possible to get more variables? like tweet link and inreply link?
It causes a bug like this bug: http://wordpress.org/support/topic/plugin-audio-player-problems-after-update#post-1343872 when used with Audio Player. Sorry if you have adressed this…
I like this plugin. Straight to the point. Is there anyway it can capture my Retweets as well?
Great plugin Ozh! Thank you sir. I'm using this on my website to pick up RT's from a twitter bot I made that will search for a certain #Tag tweeted by it's followers — to do that with your plugin I needed to change the json twitter API call to include_rts=true — problem being that when I have longer tweets posted to wordpress they're truncated after the RT @wsoppokerblog: part has been added… I'm looking to remove that 140 char limit for the wordpress posts but I'm not sure where to turn. Once again great job on this plugin and I thank you in advance for any help you can provide Cheers!
Why dose the Title/Subject and the Tweet have same contents, can I reduce the Post Title/Subject ?
It looks dull, showing the same tweet twice
Nader » It's a theme matter. Just edit your theme and make it look the way you want.
Dear Ozh,
It was not a theme thing, I did the following modification on your php script (import.php)
// Insert tweet as new post
$post = array(
'post_title' => ",
'post_content' => $text,
cheers.
Nader » as I said: theme issue to me. I'd rather have a tweet archive theme that doesn't display both post title & content (eg http://planetozh.com/tweets/) than get an empty value.
Hi Ozh Thanks for a great plugin… Any thoughts on my issue. Posted at the top of page 2. Thanks!
Thanks for the plugin..
I have 2 features request
– option to remove links and hashtags from title and shorten titles string.
– option to process links and display them the way facebook does ex. youtube videos, images, website title and desc. ….etc
gadelkareem » these are theme level tasks. Have your theme to do this.
Hi Ozh:
Thanks for your great plugin, but there is a problem: how can I say to the plugin where list the tweets? I tryed in a localhost and all tweets are in the main page, each tweet like each post. Where is the option to fil and say "list your tweets in this folder"?
Regards
Carlos
Carlos » I'm not sure what you call a "folder". Anyway, this plugin imports tweets as posts so what you got is the normal behavior. In a future version I *might* add custom post type support.
Hi Ozh:
folder means "subdomain". doesn't matter, because I understand now this plugin better. i must use a new WP installation, DB included.
Thanks a lot
Carlos Xabier
Carlos » note that you can simply activate multisite on your existing WP setup
Carlos » You might want to take a look at How To Set A Custom Post Type And Taxonomy Terms With Ozh' Tweet Archiver
Thanks Oriste for your help.
Regards
Carlos
hello Ozh,
thanks for your WP plug.
questions:
1. is it the plug or why do all my tweets show up double:
http://www.quoteguruapp.com/blog/
2. can you not put all tweets on 1 page i.e. http://www.quoteguruapp.com/twitterfeeds, instead of separate them as separate posts?
thanks,
rolf
rolf » 1: Dunno. Worksforme. 2: theme job. Code your frontpage so it doesnt display posts from category "tweets" or whatever and display them in another page. Out of the scope of this plugin.
i think your plugin does not work on wpmu…
have you tried?
thanks…
sorry :D my bad…
i give it few more chance to run on my server, now it works (on wpmu)!
great plug-in indeed. thanks!
in wordpress hosted on dotcloud.com,
it creates duplicates after running one day or two,
all tweets imports twice,
how to solve this error (may be aroused by dotcloud system)??
thx
Hi there, the plugin looks awesome, but I'm having a small problem as I've just run a "Manual Archiving", and only the last 140 tweets were imported (I have more than 2.000). I've tried doing a manual archive a couple of times more, but the plugin tells me that it's finished importing..
Thanks a lot for your help.
http://twitter.mediosordo.com/
Great plugin – keep up the good work! :)
I'm having some trouble with the import of my tweets though. Your plugin worked for a very short while, where it imported 4 tweets. Since it haven't imported my tweets at all… :-S
I have tried everything and searched the web for an answer, but without any luck. So now I turn to you for help.
It is the tweet stream on this frontpage: http://www.svadabryg.dk
FINALLY! I have just found the solution to my import problem, which I have been searching for for weeks now!
In my Twitter account the "only HTTPS" box had been checked, which apparently blocked the import of my tweets.
Hello,
I'm considering installing this. You mention installing a new instance of WordPress. Is that necessary? Will there be negative consequences to installing it on a running instance?
Thanks,
Qays
Qays » it'll import tweets as posts. Your blog posts will be mixed with your tweets.
Ok. That should be fine- kind of what I had in mind anyway. I'll probably give it a shot then. Take care.
Salut Ozh,
Found a bug (post_tag parsing), found a bugfix. Are you still supporting this plugin ?
I'd be happy to share this with you if you point me to the right place : )
Stéphane Thibault » sure :)
Hi Ozh, am I able to select just tweets withing a certain date range to archive? For example, we run a twitter account that changes to a new tweeter each week. I want to preserve an record of each tweeters efforts, and archive on their profile page on our wordpress site. Could we adapt the plugin to somehow handle that? Thanks.
Hi Ozh!
I am here again and I modified import.php to be able to process the link and display a 'Facebook like' feed…check this Gadelkareem Tweets
Great plugin!
I thought I would share the code for expanding the links with you, please let me if you have better idea.
Add full previews to your twitter feed on WordPress using Ozh’ Tweet Archiver
We need to figure out how to get this to work with the new WordPress 3.4 Twitter shortcode.