Support ThinkTwit
ThinkTwit is open source and developed for free – if you find ThinkTwit useful please help support its future development by making a donation.
ThinkTwit is a Twitter module for WordPress. ThinkTwit uses the Twitter JSON API v1.1 to display recent tweets from one or more Twitter users. It is very simple, yet flexible and easily customised. It can be placed on your WordPress page simply through drag and drop on the Widgets interface or through the use of Shortcode or a PHP function call.
ThinkTwit was created due to a lack of fully functional WordPress plugins that offer the ability to request tweets from more than one user. It was created using a heavily modified version of code written by Anders Ross at Instant Shift with added code changes by Kevin Pajak at kevinpajak.com. Thanks guys, the code has been much appreciated!
Given the code created was so useful, and the lack of plugins that did what we required, it was decided to create a plugin so that we can give something back to the community – we sincerely hope that others can benefit from this!
ThinkTwit was originally developed by Stephen Pickett when he was working for Think Consulting Solutions. Think decided to open source the code and after he left Stephen decided to continue to maintain the code.
Further thanks must go to the following for their assistance in translating ThinkTwit in to other languages:
- Maria Ramos (at Web Hosting Hub) for contributing Spanish in Spain (es_ES)
- Ogi Djuraskovic (at First Site Guide) for contributing Serbian in Serbia (sr_RS)
Features:
- Can be configured from Widgets settings (if displayed in sidebar)
- Can be implemented using shortcode or Output Anywhere (PHP function call)
- Contains default slimline CSS for integrated look and feel (can be turned off)
- Easy to configure and customise (through settings and CSS)
- Multiple instances can be deployed (like other widgets/plugins)
- JavaScript is not required (unless no-caching is activated)
- Can specify multiple usernames
- Tweets can be filtered by #hashtag or keyword
- You can select to filter between an AND or OR filter to either show tweets only containing specified usernames and hashtags or any of them
- Can specify maximum number of tweets to display
- Can specify maximum number of days back to display
- Supports no-caching, to prevent caching of tweets by caching engines such as WP Super Cache
- Supports CURL as a fallback method, if necessary
- Supports optional caching of tweets and avatars
- Cache can be manually cleared and will automatically update if the cache is empty
- Can display the avatar of the Twitter user
- Output can be filtered (using apply_filters)
- Can optionally output “Follow @username” links
- Automated cleanup process that runs periodically according to user setting
- Internationalised using i18n meaning that if it isn’t in your language it’s easy to translate!
- Gracefully deals with Twitter errors and adds them to the PHP error log
Roadmap
The following is a list of features (in order) that will be implemented in future releases (struck through items are completed and awaiting release):
- Add image support (if possible)
- Add place holder image so in case the correct avatar can’t be found it can use this
- Hashtag filtering should also filter cache
- Add option to output published as text, timestamp or not at all
- Allow configuration of avatar cache time
- Fix storing of update time in settings when making updates and using multiple widgets
- Support WordPress multi-site functionality
- Replace existing caching with WordPress Transients
- Implement check of last-modified header
- Replace URL redirection handling code with a check on response codes
Updates are usually made every 1-2 months but may take longer due to this being a side project – that said, urgent issues are usually resolved much sooner, so please Contact me if you have an issue. And please remember that this is just a side project that I undertake in my own time outside of my very busy day job; donations are always welcome!
Download
ThinkTwit is hosted at WordPress Plugins.
72 replies on “ThinkTwit”
Hello, your plugin is simple and powerful at the same time, I 3 twitters and it’s great to be able to list them all together, I probably will use it to print my tweets.
I have some requests and suggestions, to make it better:
1) before returning the output, add a filter to be applied to it 🙂
2) Add a space before span class=”thinkTwitPublished”, it’s first word is getting together with the tweet. Better yet, use a <br so that it goes 1 line below
3) I'm only able to show last week tweets, is it a twitter limitation or is your plugin? I'd like to show older ones too
4) Since more than 1 twitter can be used, add an option to show its @address instead of the user name, all my twitters have my name and I'd like each of them to be distinguished in the list
5) separate the widget class from you code, and add a function/object to print it anywwhere wanted, and a shortcode too :p
6) since tweets are sorted by date, ol is more semantic than ul
7) in line 244 u are doing str_replace using the same character, what's the meaning of that? o.O
Hi Hikari,
Wow – lots to think about there! I’ll respond per number:
1) What sort of filter do you mean?
2) Ah – here I used the class name so it can be styled as you wish. I suggest you create a CSS class of span.thinkTwitPublished and use “display: block” to force it to the next line. If you wanted space before it you could add a “margin: 5px” or something.
3) The restriction is in the Twitter API. I plan to implement a cache at some point; this will reduce calls to the API, allow it to work if Twitter goes down, and also display tweets older than 7 days.
4) I assume you mean to display username rather than name? Ok I’ll implement that as a feature.
5) Will do.
6) Good point!
7) That is a very good question! I took the code from somewhere else and have adapted it. Had a look at these lines and there seems to be no need so I’m not sure if it’s redundant from a previous use or if it’s a mistake. Either way I’ll remove it and test before my next release!
Thanks very much for the feedback. I’ve added your suggestions to my roadmap and will hopefully implement some changes this week if I have time.
1) by filter I mean
apply_filters('tag',$resource)
with it we can hook filters to your content without needing to add code direcly in your plugin
4) thanks 😀
7) I suppose it was meat to convert tag special chars to HTML codes, but it’s not being done 😛
tnx for the help, to start using it all I need is a filter that I can hook and @username linking to the http://twitter.com/username 😀
Hi Hikari,
Ok I’ve made a couple of changes but I’m really flummoxed with filters. I’ve not been using WordPress very long and in some cases I find the documentation very poor. Are you able to explain to me how filtering works within plugins?
I get that a filter modifies some content, but what exactly do you want to filter in ThinkTwit? And any idea as to how I go about this?
Thanks!
Contact me on email and I can show you.
The hook won’t change the content, it will allow other plugins to edit the content without having to hack your code.
I want it to obfuscate links 😛 I can’t leave external links on all pages, they are link juice leakers 😀
I just saw you updated the plugin, soon I’m gonna test it.
Hi, I must say that I’m not a fan of the new look. I don’t like the digits, because they make the tweets not entirely visible in my sidebar. I would prefer a thicker line between the tweets or some other solution to divide the tweets. The look was better before.
Otherwise I like ThinkTwit a lot!
Hi Ingela,
You can modify the look by changing the CSS. If you give me a link to where you are using it I can give you some suggestions of what CSS to add. You’ll have to bear with me though as my main PC is out of action so am using my work laptop but don’t have access to all my code and tools.
Thanks for the positive comment 🙂
Hi,
Only the first username appears in the site… If I change the order, the other username appears, but only one.
Hi Sergio,
Could you please explain the problem you are having in more detail? And maybe show me an example.
I believe you are saying that it will just display the name or the username e.g. Stephen Pickett or stephenpickett in my case. This is by design, what are you looking to achieve?
Thanks!
Sorry,
In the widget, in the field that say to input the usernames separated by space, a input different users and save, but the plhgin only shows the tweets from the first user in the list. If I change the order only the tweets from the new first user is published.
Tks.
Hi Sergio,
Have you checked that the other user has tweeted recently? This was the case in another instance of this “issue” i.e. it was really an issue, just that the other user hadn’t tweeted in the last 7 days and the other user had 5 of the most recent tweets.
[…] Pickett's Blog Thoughts, opinions and other useful stuff Skip to content HomeAboutThinkTwit ← ThinkTwit Update […]
Please add functionality for showing the Twitter avatars before the usernames. Your widget is excellent – the best out there – for displaying multiple user’s tweets. Now I want to show their avatars, just like Twitter, or a Facebook wall would.
Hi Aaron,
Thanks very much for your suggestion and very kind comment! I was beginning to think nobody was using ThinkTwit anymore 🙂
I will add your suggestion to the roadmap and get on to it as soon as possible – should have some upcoming weekends free that I can do this in. I’ll keep you updated on my blog as usual!
Implemented as requested, though needs a little more work to implement caching of avatars.
When I installed your plugin, and added space-delimited list of users I want to follow, the only user that shows up is ‘_’ (aka: http://twitter.com/#!/_) Dave Bug.
Could you tell me how I eliminate him from the feed and how to ensure that my intended twitter user’s tweets are displayed?
My page is at: http://www.pbspirits.com/2011/03/18/st-patricks-day-in-pb-2011/
Hi Jerry,
Could you please copy your user list and paste it in a comment between double quotes (“) and I’ll do some debugging to see what the problem is.
Thanks.
Hi Stephen,
I´m having a bit of a difficulty getting the style for the plugin to work. I´m using a theme called Biznizz from WooThemes. And after pasting your suggested code into the Style.css file I´m not getting any changes to the rendering of the tweets. I’ve played around with the properties and added some more variables but to no avail.
I´ve checked and seen that the sidebar-init.php includes the
‘before_widget’ => ‘’
as you suggested in an older post.
I´m at a loss… so any suggestions would be highly appreciated.
Btw – brilliant idea for a plugin. Next up, rendering tweets with specific keywords? 🙂
Hi Thorsteinn,
Could you please give me a link to the page where you are testing it so that I can see the output code, as this will help me to resolve your issue.
Also please explain your suggestion for keywords in more detail and I’ll add it to the roadmap 🙂
🙂 that was a quick reply.
The page is here: http://www.industria.com/newwp/
The “Industry Tweets” is where I´m having difficulties, down and to the right.
I moved the piece of code further up in the CSS file and then I was able to control the font size, but nothing else.
As for the feature request, I´d like to be have a similar plugin where I can enter search terms such as “photography, postprocessing, photoshop” or whatever and voilá! get a list of tweets that use these as either hash tags or possibly as free text search. I´m not sure of what the Twitter API allows you to do in along those lines though 🙂
Greatly appreciated.
Hi Thorsteinn,
I think the problem you are having is because you are using the wrong class names. The class name that you have in your HTML is widget_thinktwit but you are using .widget_thinkTwitTweets in your CSS.
I’d recommend that you actually use the structure that I’ve created within the widget itself which is like:
/* ThinkTwit – Twitter Widget */
ol.thinkTwitTweets {
font-size : 12px;
}
ol.thinkTwitTweets li.thinkTwitTweet {
word-wrap : break-word;
}
ol.thinkTwitTweets li.thinkTwitTweet img {
border : 0;
float : left;
margin-right : 5px;
}
ol.thinkTwitTweets li.thinkTwitTweet span.thinkTwitPublished {
display : block;
}
There is also further notation that you will find in the FAQ that you can use, but if you need help with that then please let me know.
Also it appears that BizzNizz actually has a custom.css which it suggests you should put custom CSS code in so maybe it would be more appropriate there as it would help in future updates.
I’ll add your request to the roadmap – keep checking back or follow me on Twitter and you’ll see when I’ve had a chance to update it (it’ll need a little investigation first).
Hi Stephen
First of all thanks for a great plugin. Which ticks both the ‘simple’ and ‘extremely versatile’ boxes for me.
2 questions if you have a moment.
Firstly, how can I change the message preceding the time stamp: “This happened..” For future releases it would be nice to be able to have this content user-configurable via the widget.
Secondly I put 2 Twitter usernames into my widget, but only one shows up. You can see a subpage on my personal site which I’m building here:
http://www.thriveuk.com/case-studies/
Both usernames have recent posts (one BBC and one mine), but only the BBC shows up :S
Also while it occurs to me, I couldn’t find documentation covering the following options in the widget:
Show when published
Update frequency
Thanks in advance
Andy
Hi Andy,
First of all, thanks for your kind words! 🙂
In reference to your request about changing “This happened…” this is actually on the list under “internationalisation” – I’ll prioritise this as it’s already on the list and you have additionally requested it.
And regarding your two usernames – have you tried yours on its own to see if that shows up? It may be that yours is not working or that the BBC tweets are fresher than your latest and so yours get pushed off the bottom of the pile. Maybe try yours and a less frequent tweeter (e.g. myself, stephenpickett).
I will additionally add to the roadmap more documentation on those two options.
Thanks again for your feedback!
Hi Stephen
Thanks for the comments and feedback, and hope this finds you well.
I am still noticing some ‘problems’ synchronising data with my Twitter feeds. Some posts show up fine, and others never appear in the ThinkTwit feed on my site.
I was wondering if it was an issue with the WP Super Cache plugin I use, but having deleted that cache and refreshed the page it doesn’t appear to make a difference.
Today I have posted a number of tweets, but only the one this morning shows up.
I’ve changed the ThinkTwit settings from Live (uncached) to Live (cached) and back – but it still won’t refresh the feed. Any suggestions gratefully received!
cheers
Andy
Hi Andy,
Please could you give me the usernames that you are using, and I will run a test to try to determine where they are going missing. If that works then I may need to access your site if you are comfortable with that (don’t post any credentials on here though).
Stephen,
Love your plugin. It is so much cleaner and easy to use over other similar widgets.
Your plugin unfortunately does not work with WordPress MultiSite (Create a Network). I found a simple work around in your code:
– Remove all the syntax ‘public’ in front of the syntax ‘function’
– Change the syntax ‘protected’ to ‘var’
It does breaks exclusivity standards of what php wants to emphasized, but that is the simple work around solution.
Cheers!
syhc
Hi Stephen,
The usernames for the moment are:
@BBCClick
@thrivedigital
I was wondering, is it possible to have multiple instances of ThinkTwit widgets on my WordPress site, so to have context relative content from Twitter in different areas..
cheers
Andy
Hi guys,
Sorry for the delay in getting back to you – I’ve been very busy in work with an ISO 27001 audit coming up on Monday, and things have been busy in my private life too.
Andy – I’ve tried both usernames on my dev site (dev.thepicketts.org) and your tweets come up when I use just your username, your username with mine, and your username with mine and bbcclick – for the latter, though, I’ve increased the number of tweets shown to 20. Could this be your issue?
I’ve left it up there so you can see, as I won’t be able to do any development for at least a week anyway. The entry in usernames is, without quotes: thrivedigital stephenpickett BBCClick
To answer your question: yes it is possible to use multiple instances of ThinkTwit with different content. Just drag another in to your sidebar and give it a go. Let me know if you have any problems, though I have tested previously.
Syhc – Thanks for your kind comments and for your bug report. Once I’ve finished this next development I’ll test it out and see what I can do to improve its co-existence with WordPress MultiSite.
Hi Stephen
I’m willing this to work, but there’s still clearly a problem. My site’s now reporting tweets from 2 days ago, and both I and BBCClick have tweeted since…
Also, your dev site’s reporting a bunch of errors :S unefined variables and 403’s..
I’m happy to give you access to my site, but the installation’s vanilla, and I haven’t changed anything since..
Andy
Hi Andy,
Yeah sorry about my dev site – I found some time to do more development so had to take it and test my code.
Could you please E-mail me your credentials to meethoss at gmail dot com, and I’ll take a look – once you’re done you can then change them for security. I can probably have a look Wed, Thu, Fri this week.
I’m also on MSN Messenger etc. so we can discuss in real time, but we can sort that out through E-mail.
[…] Main menu Skip to primary content Skip to secondary content HomeAboutThinkTwit […]
Hi Stephen,
this looks like a nice extension. I’m trying to implement it in my WordPress 3.2.1. I’m using the Shortcodes way of integrating it. However, it only loads the posts from your twitter account even if I replaced the username. Is the extension working under version 3.2.1 of WordPress? Any idea? Thanks.
Etienne
Hi Etienne,
Please could you post your shortcode and I will check that it is valid, and do some further testing if necessary. The extension certainly does work under 3.2.1, both are used on my blog 🙂
Maybe I’m a dunce, but where can I find the shortcodes for this? It would be nice if you included a page in wp-admin with brief instructions on how to use the plugin (other than with the widget)
Hi Ben,
You can find the shortcodes in the FAQ on the WordPress Plugin site, that is http://wordpress.org/extend/plugins/thinktwit/faq/. It’s about half way down. Thanks for the suggestion though, I’ll add something in to the admin section somewhere to make this easier to find! 🙂
Great plug-in – just what I was looking for. My client wants a Twitter feed that displays a certain number of days then after that shows a default message which this plug-in does – excellent!
However, the plug-in default is 7 days, my client would like it to be 3 days before the default message shows. How can I change this please?
Thank you!
Hi Keith,
Thanks very much for your kind comments! There’s currently no way to change this but I will put it on the roadmap with an aim to implement in my next release. I’ll try to get it done this week if possible.
Hi Keith,
Managed to get some time to do this tonight. Please take care to read the notes when upgrading as you will need to add the max_days value to your widget/shortcode/function call.
If you find this useful please rate it at http://wordpress.org/extend/plugins/thinktwit/.
Hi Stephen,
First, let me say thanks for the fact you actually respond to comments here – great to see.
And of course, I have a request / suggestion – not sure if I should put the details here or somewhere else, but here goes. What I really want is the resultant array from ThinkTwit::get_tweets after it has been called by parse_feed – it has all the goodies inside it (like the unformatted datetime) already sorted and ready to go. Then I can display the tweets how I want.
I think they way I would do this would be to split the retrieval and display bits of parse_feed into 2 functions, then expose the retrieval function publicly (I think anyone who wanted this feature would be playing in PHP, so no need for shortcodes etc)
What do you think? I’m probably going to hack your plugin locally to do what I need, so if this is something that interests you, I would be more than happy to share.
Hi Steven,
Thanks for your comments. This is definitely the place to add requests and suggestions.
I can certainly integrate what you need – I’m currently working on some changes which affect this area so I’d suggest you either wait for me to complete these (this week) and then share the code with me or I’d be happy to make the changes in this update?
Hi Stephen,
I did a quick and dirty hack last night, just doing the bare minimum required to your code to get what I wanted 🙂 Feel free to use or discard as you fancy.
You can find a patch here: https://github.com/smcphill/thinktwit/commit/5732f108ce06410236bb3de7f4097783bf247388.patch
(Note you might need to chop the first few lines of metadata cruft, and run patch using -p1 from the thinktwit root dir)
Or download the full plugin from https://github.com/smcphill/thinktwit
also, if you’re interested, here’s a patch that exposes the individual tweet’s “status” URI. I’m using this to provide a “more” link when the content is truncated (looking for “…” in $tweet->content), so the user can view the entire tweet.
https://github.com/smcphill/thinktwit/commit/69f05680800a51aa0aa0501aab618d9a3012e405.patch
Hi Steven,
Thanks for passing me this. Unfortunately the code has changed loads so I can’t just patch this in now and my brain isn’t working at the moment (have been a bit manic in work trying to finish our new company site to launch next Monday) – any chance you could summarise what you have done with snippets of the code in an E-mail to me? (meethoss at gmail dot com)
I’m just committing the changes so you will no doubt be able to see what I’ve done. It encroaches a fair bit on what you have done but I was thinking rather than hack this in maybe we could incorporate what you need in to the Tweets object as well and provide some accessors somehow so that people can use it without modifying the ThinkTwit code (not sure how you’ve used it?).
Anyway, appreciate the input, thanks!
I updated ThinkTwit to the latest version (1.3) on 27 October 2011. I now have the Text 1 below as a “banner” on my Dashboard. Ordinarily it would just be irritating but when I delete spam via the Dashboard, I get message 2 below which makes me wonder if there is a bigger problem. Your thoughts appreciated.
1. Warning: call_user_func_array() [function.call-user-func-array]: First argument is expected to be a valid callback, ‘ThinkTwit::ajax_request_handler’ was given in /home/username/public_html/wp-includes/plugin.php on line 405
2. Warning: Cannot modify header information – headers already sent by (output started at /home/username/public_html/wp-includes/plugin.php:405) in /home/username/public_html/wp-includes/pluggable.php on line 934
Any thoughts you have to fix this problem would be welcome.
Hi Michael,
I think I’ve identified the issue. I’m going to send you an update to your E-mail specified when posting the comment – hope this is ok. Please let me know if it works and if so I’ll include in the next update.
I just updated ThinkTwit to the latest version – and as soon as I did so (as in, the “updated successfully” page showed, but when I clicked to go back to the plugins page it failed), every page on my site including the admin pages started loading blank, as did the page source, so I can’t deactivate, uninstall, or check the code for obvious problems. Any ideas how to fix this?
Hi Chris,
I’m very sorry to hear about that. Can I suggest that you access your site via FTP and go to /wp-content/plugins/ and delete the ThinkTwit directory. This should hopefully allow you back in to administer your site. Once back in see if you can access the Plugins page and de-activate then delete ThinkTwit before re-installing again. If not then you may need to go in to the database and delete all associations to ThinkTwit as described in the uninstallation instructions at http://wordpress.org/extend/plugins/thinktwit/other_notes/.
Please let me know if this does not resolve your issue and I will try to help you out further.
Hi Michael,
As I mention in a comment above, I love your plugin. However agreeing with M Power on October 28 2011, the two issues (primary the first one) are also affecting my wordpress install.
I am also getting this error: file_get_contents(http://twitter.com/users/FOSStudentsAssn.xml) [function.file-get-contents]: failed to open stream: HTTP request failed! HTTP/1.0 400 Bad Request in /home/fosstudentsassn/fossa.ca/wp-content/plugins/thinktwit/thinktwit.php on line 363
which relates to the error above.
Since I did backup my website, I guess I will have to roll back to a previous working version. However it is advisable not to upgrade to the latest version since it is causing errors.
Hi syhc,
Think you got our names mixed up but no problem 🙂
I’m sorry to hear about your issue. I’ve had another user (in addition to Michael) report the issue and they have confirmed the fix I made has worked so will E-mail you over the fix and if you could try it and confirm it works then I will commit it as an update for everyone else.
I am E-mailing to the E-mail address you provided when posting your comment however if this doesn’t reach you please let me know.
Stephen, I recently installed your ThinkTwit plugin on my website. However, it is not showing the profile pictures of the respective twitter accounts. I am only getting the name of the user in a hyperlink. I very much want the profile pictures to show, as they look great in my sidebar. Can you help me sort this? I am thinking it might have to do with my using WP Total Cache?
Many thanks, looking forward to your help.
Jeffrey