Update: 20-02-2010
Twitter Stream has now been updated. Support has been added back for parameter style calls to the function, twitter_stream(option, option, option) however you are strongly advised to change to the array/query string method which you can use by calling the wrapper function twitter_stream_args();. Some features like retweets & showing followers are not available through the old parameter method due to coding limitations & are only usable through the twitter_stream_args() function. You can find more on how to use the new function here.
I haven’t been able to test ReTweet support as much as I’d have liked so please report any bugs you find so I can fix them ASAP. Also those using WP-Super-Cache should update to 1.9 as soon as you can as I have fixed a huge problem which caused WP-Super-Cache to stop allowing Twitter Stream to update it cache.
Original Post
It’s been just over a year now since I released my first plugin which you may all know is The Attached Image, so I thought it was time I released another plugin. I hadn’t actually gone out on purpose to make this plugin, but a client’s website needed a simple Twitter feed plugin & while there are already WordPress plugins out there that do the job they insisted a custom one be built. So I set about making it & rather than have it sit in my WordPress functions folder doing nothing (other than working on the client’s site, of course) I thought I should release it as a plugin for anyone to use.
Althought the client requested the code be made I still retain the rights to use it as I wish. Just in case anyone was worrying about the useage rights. That means the plugin is under GNU (GPL) license as required by WordPress’s plugin repository.
Remember it is a very simple Twitter plugin, it is designed to do one thing and one thing only, show a user’s Twitter stream. Anyway here is some usage information.
What is Twitter Stream?
Twitter Stream is a very simple plugin originally created as a small function for a client’s website. Rather than have it sit doing nothing in my WordPress functions folder I thought I would extend it and make it into a plugin for everyone to use.
It’s functionality is very, very simple. It is designed to simply grab a set amount of status updates from the Twitter user account you request. If there are enough requests I may add some additional features, but for now it is designed to be very simple and run as quickly as possible while using the least amount of resources possible.
What Features Are There?
- Show the twitter timeline for any public username.
- Choose how many tweets to show.
- A Widget or template function is available.
- File caching to stop API overuse.
- Optional date shown in xx ago format, also links to permalink for the tweet. (Requested by Ron)
- Customizeable via CSS. (see the ‘Can I Style It?’ section below)
- Authentication for better API limiting & ability for protected users to show their tweets.
- @replies now link to the user profile of the user you are replying to.
- #tags now link to the Twitter search page for that hash tag.
- Link to user’s profile, customizable via CSS & via function parameter.
- Follower count can now be shown.
- Retweets can now be shown with normal tweets.
How Do I Install It?
You can download it from the WordPress repository here, and then install it as you would any old style WordPress plugin, which is as follows:
- Download the zip file and unzip it to somewhere, say your desktop.
- With any good SFTP client upload the extracted folder to your
wp-content/plugins/folder. - Enable the plugin in the WordPress plugin page.
Of course you can also install it by using the WordPress auto installer.
How Do I Use It?
Well because it is so simple there wasn’t really a point in making a admin page for two options. So there is a widget available for all you widget fans (WordPress 2.8 or later is required though), or if you’re a good ol’ fashioned function user you can also call the plugin by using twitter_stream_args();. To pass options you can either use a query string or an array (preferred) like so:
twitter_stream_args(array('username' => 'twitteruser', 'password' => 'password', 'retweets' => FALSE));
or
twitter_stream_args('username=twitteruser&password=password&retweets=false');
You can find a list of all the available options here.
What Are The Connection Methods?
Twitter Stream features three different connection methods due to problems with certain server configurations. The preferable way to connect is CURL, however it may not be installed on your server. Twitter Stream will try to connect try via CURL by default, if CURL is not available it will try the next method which is fopen. fopen is generally always available, however some servers have URL access via fopen turned off for security purposes. If both CURL & fopen aren’t available it will try socket access. This method nearly always works, if Twitter Stream still can’t connect then your server is locked up tight & probably doesn’t allow external file access at all (highly unlikely). However feel free to contact me & I’ll try my best to help should this occur.
How Do You Get Round The API Limit?
Twitter has a built in API limit that stops a single IP from abusing the service. It is approximately 150 requests per hour from a single IP address, 20,000 if your IP is whitelisted by Twitter (you must make a request to twitter for whitelisting). If you exceed that too many times you may be blacklisted from the Twitter API, which isn’t good. To get round this Twitter Stream has a cache system that asks twitter for the users timeline once every 30 minutes & stores it locally. If you aren’t happy with 30 minutes you can change it. If you open the plugin file and find line 159 $thirtyago = time() - 1800; you can change 1800 to any amount time in seconds. Just remember that if you lower it too far & you get blacklisted due to too many requests, I am not responsible. Finally, lowering the time too far will cause the cache to be renewed far quicker, this can cause undue stress on the server.
What About Shared Servers & The API Limit?
This is a massive problem. If you are on a shared server there is a huge chance someone else may have put your servers IP, which you all share, over the API limit. I’ve added a new error message that will tell you if you have exceeded the API limit, if this is the case & you are on a shared server, there is a way around it. I have added user authenication into the plugin. This means if you give your Twitter username & password it will log in to Twitter when it grabs the tweets, this changes the API limit from the servers IP to your accounts API limit meaning no sharing. Please bare with me though as this is all theory & I have been unable to test it however with some basic testing I have performed the API requests left when authenticated are different to the API requests left when not authenticated meaning this should work.
Sometimes I Get An Error Message!
There is a built in error message that is shown if Twitter fails to provide a vaild XML file. Reasons for this could be that the Twitter API is down (which Twitter claim is highly unlikely), or the plugin failed to read the cache file. If this happens, and you know Twitter is available, try deleting the cache file which is named username.cache. It is located in the same folder as the plugin, that’s generally wp-content/plugins/twitter-stream/username.cache. If you continute to get the error please contact me & I’ll try and help out.
Sometimes The Date Is -xx Seconds Ago?
This is sometimes difficult to get your head around. Simply put it is caused by your servers clock being faster or slower than Twitters clock. To work out the time ago it takes the timestamp (number of seconds since Unix Epoc) and takes it away from the timestamp at which the tweet was posted. If your servers clock is slower than Twitters, for the first few seconds it ends up giving a negative value therfore seeming as if it was posted in the future. It could be something completely different involving Aliens, badgers and evil pidgeons, but that is the most sensible thing I’ve been able to come up with. If you have a better idea what it is let me know.
Can I Style It?
You can. I haven’t added any styles so I could keep the plugin on one file & keep it free of clutter. The available CSS classes are:
.at-replyfor @replys..hash-tagfor #tags.a.twitter-linkfor autolinked URL’s within the timeline.a:hover.twitter-linkfor autolinked URL’s within the timeline when they are hovered over.a.twitter-datefor the date permalink.a:hover.twitter-datefor the date permalink when it’s hovered over..profile-linkfor the newly added link to user profile..follower-countfor the newly added follower count.
Can I Have A Options List?
Sure. The basic usage for in the template is this.
twitter_stream_args( [query-string/array] $args);
Here is the info for each parameter.
usernameshould be a string and is the username of the Twitter timeline you want to return. Required.countshould be a string and is how many tweets to return. Default ’10′.datebool or string. If set to TRUE it will show the time ago with a hyphen as a default separator. If it is a string of anything other than ‘TRUE’, ‘true’ or ’1′ it will use that as a separator.passwordyour twitter password as a string. Needed for retweet support. If you do not enter your password & enable retweet support it will just ignore it & show only normal tweets.profile_linka string. Allows you to customize what the link to your Twitter profile (shown at the bottom of the tweets) says. ‘Visit My Profile’ by default. Use a space, like this ‘ ‘, to show nothing.retweetsbool, true or false. Shows retweets with normal tweets. If you haven’t entered your password this value will be ignored.show_followersbool, true or false. Shows the number of followers.
Here is an example using all parameters.
twitter_stream_args(array( 'username' => 'twitteruser', 'count' => '10', 'date' => FALSE, 'password' => 'password', 'profile_link' => 'Visit My Profile', 'retweets' => FALSE, 'show_followers' => FALSE ));
I Need A Translation!
You can download translations files for the plugin here. These are .po & .mo files in a zip for the languages available. For the translation to work you only need the .mo file placed in the same folder as the plugin.
- Swedish Translation – Thanks to Albert Johansson
- Belarusian Translation – Thanks to FatCow
- French Translation – Thanks to Tolingo.com
I have provided the .po file for those who would like to amend or alter anything. Should you do that please send me a copy of the amended .po file so I can update the files here. If you would like to translate Twitter Stream into a language not available here you can download a blank .po file here. It is marked with Swedish codes but it is actually blank. Once you have filled that in send me a copy of the .po file & I will create the .mo file and offer it for download here. I will automatically credit you, but should you not want to be credited please tell me so in the email. You can email .po files to pablorobinson [at] gmail [dot] com.
A huge thank you to those who have translated so far & a big thank you to anyone who may help in the future.
I Have A Feature Request! / I’ve Found A Bug!
You can report all bugs via the comments which I read as soon as I can, or you can send me an email via the contact page. Either way I promise to try and get back to you as soon as possible.
Want To See A Working Demo?
Yep. If you want to see the Twitter Stream up & working, visit Medibolism and scroll down to the footer, it’s in the brown part on the right.
Where Do I Get It Again?
Once again you can download it from the WordPress plugin repository here, or you can install it via the WordPress auto installer in your blog admin.
I Love It, Can I Give You Some Love?
Wait… What?!! Oh you mean that sort of love. Sure.
You can help out in one of three ways. You can donate to help cover server costs & the cost of the coffee that keeps me coding. You can do that by clicking the button below.
You can buy me a present from my Amazon Wish List which would be very much appreated, or you can simply spread the word about Twitter Stream & The Attached Image.
Well that’s about it, again this is designed to be a very, very simple plugin. As I’ve said if you find any bugs or have any requests let me know.
Note: Twitter bird artwork in header image created by lisa-marieart.com. Used with permission.
*We currently have £44 of the £90 needed to keep our server running.
Leave a comment
Latest Posts
We're Saying...
It's late here in the UK but it's the 30th so a big Happy Birthday to @Y_Strahovski loads of hugs 'n kisses, hope you have a great day. - 10 hours ago
Wow! Jeffster are awesome and @Y_Strahovski has one hell of a throwing arm, lol. http://yfrog.us/n8b8xz (via @kentuckysocal) - 6 days ago
@AshBob87 No worries. Glad I could help out. ;) - 6 days ago
@AshBob87 No problem. I just found it a few seconds ago. Was sitting in my bookmarks all along. *facepalm* http://bit.ly/cI9cQS - 6 days ago
@AshBob87 Thanks. ;) I can't find the tutorial I followed anymore. :( - 6 days ago

Discussion: 113 Comments
This plugin is exactly what I’ve been looking for. Though I can’t seem to get it to work on our site. I currently have 2 instances of it in our sidebar, but nothing seems to load. Any ideas? Thanks!
Well I’m really confused as I’ve put error messages in place for every problem I can think of. If possible can you tell me if you have CURL or fopen (with URL access enabled) available?
I’ll have a look through the file for any problems, but as if works everywhere else so far I’m guessing it is something to do with your server configuration.
I may have found something. The only point I can find where there is no error message is if
fsocketopenfails as it’s highly unlikely.If you can try editing the
twitter-stream.phpfile and change:if( !$fp ) { return FALSE; }to
if( !$fp ) { echo 'Unable to open a connection to Twitter. Ooops!'; return FALSE; }If when you refresh your site you see that error it means it was unable to connect. If that happens I am currently unaware of a way to fix it, but I’ll keep looking. If you have CURL or fopen available though this won’t matter. Just thought I’d share this just in case.
Ah, thanks so much for the fast reply. I added that code, but still nothing shows up.
I looked up CURL in my webhost’s wiki and it seems like something might be disabled.
You are using Dreamhost? Bizzare. This site & the site with the Twitter Stream demo on are both hosted on Dreamhost & both CURL and Twitter Stream works fine… I’m really not sure what is going on.
Could you please find the following line.
//For each status update loop through foreach($twitxml->status as $tweet) {Change it to this.
print '<pre>'; var_dump($twitxml); print '</pre>'; //For each status update loop through foreach($twitxml->status as $tweet) {If that works can you tell me what the output is. You may need to do it quickly & restore the code back to normal as quickly as you can as if it works it will produce a fair amount of messy output which you probably won’t want showing on your site.
Let me know what you get. Again I’m really not sure what’s going on but I’ll keep trying my best to solve it.
Also just to let you know I’ve just visited your site & I’m seeing tweets now. If you can let me know how you fixed it, it could come in handy for anyone else who has a similar problem.
Thanks for the great plugin – my last twitter plugin died on me so i was looking for a replacement.
Unfortunatley I just installed it and getting the message:
Your Twitter stream could not be collected. The most probable reason is that Twitter’s API is unavailable or your website has exceeded the API limits imposed by Twitter.
And now I’m thinking… i am on a shared server. I wonder if somebody else on my server is abusing twitter- the api limit is tied to the server’s IP address right?
It is yes, but even on a shared server (like mine is) it’s quite hard to hit the limit. I’ll see if I can come up with some way to tell if you have been banned. That message normally means that the response the plugin is getting isn’t valid , if your server IP hasn’t been banned. I’d you can use the instructions in my comment above to find out just whatt is being returned then I’ll be able to help a lot more.
So I tried that, but I moved the commands up to right after
@$twitxml = simplexml_load_string($content);Because it wasn’t triggering in the other location.
It showed; bool(false)
so it seems that $twitxml is completley empty.
I did check the httpd error log on my server and didn’t see any errors.
Very strange. I’ve never come across a time when
$twitxmlwill be false.I’ve just updated the server with a new version, with a lot more verbosity when it comes to errors so if you can update & try again it may shed some more light on the problem. I’ve also added a API limit check so that should solve whether or not you have hit the API limit or not.
If that doesn’t help you could try moving the code above the
$twitxmlline & changing it tovar_dump($content)as that contains the info before it is parsed.Sorry for the problems & thank you for helping debug the problem. Without help from people like you this plugin wouldn’t work, so thank you.
Thanks Paul, no problem, I don’t mind doing some troubleshooting – I used to do tech support for a living
I updated the plugin and now it is saying:
cURL failed to retrieve any results.
Your Twitter stream could not be collected. Normally this is caused by no XML feed being returned. Why this happens is still unclear.
I’m starting to suspect it’s something with my sever? It is a VPS that is fully managed by me, so it’s entirely possible I broke something.
Hmm. I use a check to see if cURL is installed. The check is to see if
curl_init()exits which would normally suggest that cURL is installed. Either cURL isn’t installed & for some bizzare reason it’s thinking it is or cURL is broken.You could try running a blank PHP file with
phpinfo();in it to see if cURL is on the list. You could also try adding$method = 'fopen';or if that doesn’t work$method = 'socket';to just above the call totwitter_stream_connect()inside the plugin. That will force it to skip using cURL & use an alternative method.Let me know if that works & I’ll try and see if I can come up with a reason for cURL failing.
Again thanks for the help with the debuging.
Hello Paul,
I have the same problem as Sean : nothing is showing up.
I did add the line
echo ‘Unable to open a connection to Twitter. Ooops!’;
and still nothing.
Then I added
print ”;
var_dump($twitxml);
print ”;
And got this :
object(SimpleXMLElement)#3434 (2) {
["request"]=>
string(49) “/statuses/user_timeline/noodlesninja.xml?count=10″
["error"]=>
string(74) “Rate limit exceeded. Clients may not make more than 150 requests per hour.”
}
Maybe it’s because I’m on a shared server.
Just in case, I deleted the WP to Twitter extension which was installed but deactivated.
I’ll see how it goes…
Yep that message is unfortunately because the server you are on has requested stuff from the twitter API too many times. I am currently adding in a error system so that it will display the error returned from Twitter instead of showing blank.
From looking at the twitter API documentation it seems that if you provide both your username & password it will limit your requests based on your username rather than your servers IP address. So I may try and add in authentication. Also I misread the API and the API request limit is 150, 20,000 is for whitelisted IPs approved by Twitter.
Sorry.
OK. My tweets did eventually appear (but then I removed the widget from the time being) so I guess it would work but delays are to be expected. An authentification would be a good workaround.
Also an option to avoid showing the @replies would be interesting (or an option to show only the tweets with a specific tag such as #wp).
But then your plugin will start to lose some of its simplicity…
Yeah I’m trying to keep it as simple as possible, however it’s bound to end up becoming complicated code wise. I just want to try & keep it’s functionality simple.
It would be possible to not show @replies, however it would be difficult to deal with the fact that you would have less tweets after removing the @replies than you requested. #tags would be difficult too. I’ll put them on my feature list though & see what happens.
I’ve just uploaded the new version with authenication added, if you provide a username & password it should use your accounts API limit (which is still 150, I believe) however it won’t be shared like your servers IP is. The cache should stop you from ever running out of user API requests though.
I’m just about to add instructions to the post to explain how to use authenication, but if you are using the widget & not the template call it’s really as easy as putting in your details.
Hope it works for you.
I am *very* new to WordPress and have never used PHP before. My theme is not widget enabled unfortunately so I can’t use the widget.
In the instructions it says to put in the PHP code. Where exactly do I put it?
Also, once that’s in there and working, where on my site will my Twitter feed show up?
Thanks!
Kelly
Oops, it delete the piece of PHP code, but anyway – the piece where I specify my username and # of Tweets to show – where do I put that snippet?
Hi, Kelly.
It’s ok I know which code bit you mean. WordPress is a little temperamental when posting code in the comments.
It is different for every theme, but the basic instructions are the same. Open both your website & the WordPress admin so you can switch between them. In the WP admin go to appearence->editor. If you want it to show in the sidebar and the theme creator has been sensible you will need to open
sidebar.php. Then find where you want the your tweets to appear & place the PHP code you are talking about. Press update & then go to your other page with your website open in it and refresh it to see where your tweets have appeared.Hopefully that will help you. It’s kind of a crash course, but if you need any more help with that & with WordPress in general you could try wordpress.tv where they have lots of video tutorials showing you how to use practically everything inside WordPress.
Hi,
I put it in the right place, but now I’m getting the error “Rate limit exceeded. Clients may not make more than 150 requests per hour.” Any fix for that?
Thanks for getting back to me so quickly!
The error suggests you are on a shared server. Shared server means there are lots of people on the same server as you (I am also on one). Shared servers are common unless you pay a lot for a private server.
Being on a shared server means that Twitter’s 150 request limit is spread across the entire server, meaning anyone else using a similar twitter application uses the same 150 requests as you.
To get around this you have to log in to Twitter’s server so it counts your API requests and not the servers. You do that by changing the PHP command slightly.
twitter_stream('yourusername', '10', FALSE, array('username' => 'yourusername', 'password' => 'yourtwitterpassword'));The function must contain all the sections or it won’t work. If you don’t know, the first is the username, second is how many tweets to pull back, third is if it should show the time it was tweeted & then your username & password.
I hope that helps. If you are still confused let me know I’d I’ll help as best I can.
It seems to be working now. I’d rather not include my password in code that could potentially be hacked, so I’ll just live with it like this. Thanks!
No offence meant but it isn’t really possible for someone to get the password. It would be written on the template page in PHP which is parsed by the server before the page ever reaches the end user.
The best example is the fact that your MySQL database password (which holds all your WordPress data) is written in plain text on line 25 of wp-config.php. That is completely safe as it is impossible for someone to see that unless you give them FTP access to your server.
Saying that it is up to you, I just thought I’d try to reassure you that it is not at all harmful & is not stored in anyway to be hacked.
Wow… That was one very quick update. (^_^)b
Thanks Paul, it is working fine with the 1.2 update and using my twitter password in the widget.
I’ll now need to tweak the CSS before activating it again…
(BTW maybe you should delete that first comment from “Cure Internal Hemorrhoids”, seems like spam to me)
No problem.
Thanks for that, I meant to spam it ages ago and never got round to it. Tricky blighter got past Akismet. Those spammers must be getting cleverer.
Hey Paul,
Seems like it works sporadically. Maybe I’m hitting the API limit and it has to wait a while for it to work again or something?
If you’ve updated the plugin & you were hitting the API limit it should show a message saying you’ve hit the limit. If you have updated & it’s still happening, I’m out of ideas.
I’m on dreamhost & don’t have any problems running the plugin.
Yep, looks like we’re hitting the limit. Is that from visitors or the plugin itself?
It’s probably neither. If you are on a Dreamhost shared server it will probably be due to other people on the same server as you using Twitter API requests. You have to remember that it’s 150 requests for the server’s IP address, so it’s counting all requests from all users on the entire server.
If you want it to count only your own requests, you would have to log in to Twitter using the new authenication option I’ve put into the plugin. Twitter then counts API requests against your username, which is still limited to 150 per hour, instead of the entire server. As the plugin caches API requests for 30 minutes you’d probably never hit your user API limit.
Entered our passwords, I’ll let you know if we get the rate limit error anymore.
We’re also randomly getting this error: “Your Twitter stream could not be collected. Normally this is caused by no XML feed being returned. Why this happens is still unclear.
”
Thanks again!
Well as it says unfortunately I haven’t been able to find the cause of that error yet, and since it seems to be near impossible for me to replicate I doubt I’ll be able to figure it out yet. I’ll keep working of trying to fixing it though.
Love the Plugin; however, I would like to use my PHP file on Thesis Theme 1.6 to insert Twitter-Stream anywhere I want on my page. Is there a way to do that?
I’m not sure I understand as I haven’t had much experience with Thesis… If you could elaborate a little I’ll try to help you as much as I can.
P.S. If you mean can you get Twitter Stream to show up anywhere in a PHP file then yes by using the function written in the post above.
I love the simplicity of your Twitter plugin; however, I would love to insert a visual divider between each tweet such as found on Medibolism. How would I do that?
Thanks!
Hi Bryon,
The divider was done via CSS. Each tweet is inside a <p> tag and all of the tweets are inside a <div> with the class twitter-stream.
On medibolism it is done by adding a bottom border to the paragraph tags. So the CSS could be:
div.twitter-stream p { border-bottom:1px dashed #000; padding-bottom: 10px; }That would add a black dashed divider like the one on Medibolism. The padding just adds some space between the border & the end of the tweet.
Hope that helps.
Many thanks, Paul. I’m still very much in the learning phase and did not know I could modify paragraph borders. After some playing, I’ve got the separators working on my test website: http://www.irunfar.com/wp/ .
Not problem, I’m glad I could help & teach you something at the same time.
Also thank you for the donation towards the site hosting. It’s greatly appreciated.
Perfect Twitter plugin, simple and clean. I would love it even more if the time could be translated to the active wordpress language, in my case; swedish.
Is this going to happen? I would love to help out if that is necessary.
If you have any experience with i18n within WordPress I would love your help. I have next to no knowledge when it comes to i18n other than
__()&_e().So if you can provide any help, yes I’d love to add language support.
Hey,
Just wanted to say I’ve managed to wrap my head around i18ning the plugin & it’s all done, I hope. I’ve updated the plugin & provided a swedish po file with it. If you could fill it in, as I don’t know anyone else who speaks Swedish, and then email me a copy back it would be amazingly helpful.
Let me know if there are any problems & I’ll help out as much as I can.
P.S. Just in case you don’t know, you can edit po files using PoEdit.
Thank you! Extremely good response! I will take a look at it tomorrow.
Thanks again!
No problem, I’ve been meaning to start learning about internationalization within wordpress plugins.
Thanks for translating I would have the first clue how to translate into Swedish.
I get this error (I’m using widget, not PHP code to display):
No user information was returned. This normally happens when you have used an incorrect or invalid username.
The above error happens when I try to show 1 TWEET, even if I entered correct username. However, when I set widget to show 2 TWEETS, the error will disappear, but ONLY 1 TWEET will be displayed. If I set it to show 3 TWEETS, only 2 TWEETS will appear. Always, 1 less it seems.
Hmmm very strange. The only problem like you’ve described that I have managed to come across is a quirk of Twitters API. However what you have described isn’t what that quirk does, normally if you have a small amount of tweets & say 1 is an at-reply you end up with that tweet missing as Twitter filters them from it’s user timeline API. If you have a large amount of tweets (which I assume you have) then it doesn’t affect you as you have enough normal tweets to counteract the missing one.
The problem with this bug is that in my code I don’t have any code that counts the tweets, Twitter does all that before hand. So any problems with that should be coming from Twitter. Just to be safe though I’ll look through the code & make sure there isn’t anything amiss.
Just another little message to let you know I have checked out Twitter Stream & I can’t, no matter how hard I try, get it to replicate the problem you are experiencing. I have also pulled your Twitter timeline into the plugin on my localhost (since you have your tweets public) and I got the correct amount of tweets as I asked for.
Since the counting is done by Twitter & not my plugin I’m not exactly sure what is going on. You can test the URL that the plugin uses if you like. It’s
https://twitter.com/statuses/user_timeline/username.xml?count=nwhere ‘username’ is your username, and ‘n’ is the number of tweets you want.If you can think of any other reasons it might be doing that please let me know & I’ll see if I can help any more. Sorry that I haven’t been much help.
Finally found a twitter plug-in that gets the IDs of each tweet’s permalinks correctly! Nice one! I love it!
I want to say thanks and also want to suggest 2 little functions:
1. Add an option that links to the @replies/mentions/RTs
2. Add an optional link to the twitter profile page at the bottom of the widget. It will be ideal if the text is customizable and there is some css classes for styling.
No problem. I aim to please.
As for you feature requests, I love ‘em I’ll add them sometime today if I can. I’ve been really busy lately, but I’m sure I can squeeze them in sometime today.
Thanks for your kind words & look out for that update later today, hopefully.
P.S I can add a link for at-replies/mentions but RT are removed from the API timeline by Twitter and therefore will never appear. I believe it is to save resources on Twitters end although I could be wrong.
Awesome, thanks.
Hey, I’m just a little confused by what you meant by a link to @replies/mentions… As there is already a permalink on the date, where would you like the @replies/mentions to link too?
I’m adding the second request now, I just need to check what you mean by the first request.
e.g. http://twitter.com/SuButcher/status/7994423913 it has a “mention” @tepilo
Yep so the @reply links to the user profile of the user you are replying to. I’ve added that & I’ve also added a link around #tags to a twitter search for that tag.
It should be available for update now, unless WP’s plugin server is having one of it’s slow days.
That’s ideal to me. I’m looking forward to it! Thanks for the great work mate!
The plugin don’t work with the new Twitter Retweet funktion. It displays “No user information was returned. This normally happens when you have used an incorrect or invalid username.” if there is a tweet in the new retweet format.
Hi John,
That isn’t actually a problem with the plugin. All retweets are stripped by Twitter’s API before the plugin ever recieves them. There is a way to merge them, but only if you authenticate a user with Twitter & not everyone is willing to do that. So for that reason I have not added retweet merging.
It does however cause a problem where by if you request 10 tweets & 9 of them are retweets Twitter doean’t auto correct & give you 10 standard tweets, it gives you 1. I am currently working on a fix for this problem, but as it’s Twitter’s API that makes the mistake it’s very difficult to fix.
Hope that helps.
Hi Paul,
thank you for the quick response.
I try to request only 1 tweet (the last one) and if this is a retweeted tweet (= created with the new retweet funktion) I get the error message “No user information was returned. This normally happens when you have used an incorrect or invalid username.”.
Twitters API doesn’t return retweets in it’s standard API requests. It requires special coding and authentication from the user. Since not everyone wants to authenticate themselves I have left this option out.
The reason you get that error is because if you ask the Twitter API for 1 tweet and the last tweet you did was a retweet it will still count it as being a tweet but it will then be filtered out by Twitter before returning them to the plugin. It can be difficult to understand and first and I am trying to find a way around this problem but so far I haven’t had any luck.
I am considering adding retweet support as an optional feature in the next version.
I just started using Twitter not too long ago, since then I’ve begun to love it. What started out as a hatred for Twitter it’s allowed me to network with people in my business alot easier. News and updates happen in quickly which makes for a great social communication app.
Love the plugin! Can you tell me how to edit the “Visit My Profile” text? I want it to say something else. I think you sort of explained how to do this, but I need the directions spelled out a little more clearly. Thanks!!
Hey Katie,
If you are using the widget then you just write the text you would like in the last field in the widget options. If you are using the function call you would have to write something like:
twitter_stream('mytwitname', '20', TRUE, FALSE, 'Visit My Twitter Profile');change the last bit to customise the text. Just remember to change the options to whatever you have set, so replace
mytwitnamewith your username,20with the amount of tweets to get,TRUEwith whether you would like the date shown or not (true or false),FALSEif you don’t want to log in to twitters servers & then the text for the profile link.Hope that helps.
Well I feel sheepish! Thanks for pointing out the quick and easy answer, Paul. Love your plugin, especially because it doesn’t overload my shared server with API requests
No worries Katie, it happens to all of us. Glad you like the plugin, and let me know if you have any requests or any thing.
Is there a way to include the re tweets in the time line?
There is, but it would require a bit of a code re-write. I am planning to add it soon, but it requires the user to authenticate themselves to Twitter.
I’ll try to add a section in soon where you can choose whether to login to Twitter & receive retweets.
Sorry.
This is such an invaluable plugin — really, as a customer/sometime-victim of shared hosting, so few Twitter WP plugins “get” the need for solid authentication, and this nails it. That said, the only thing holding me back from being able to across-the-board recommend this as a 100% viable plugin for my clients’ needs is the lack of a feature for hiding @reply tweets (it’s a common/growing desire). Any guess/ballpark when this might be included? Again, great work, and thanks for providing it!
Thank you Jon it’s always nice to hear that the hard work that goes into creating a WordPress plugin is appreciated.
Right at this moment in time Twitter do not provide a method to remove/hide @replies from the timeline. I could do it manually, but the problem becomes even worse. The only way to do it would be to make 2 requests to Twitter instead of 1.
I’ll try and figure something out.
ETA will probably be within the next few days.
Just another little message for Jon. I am currently trying to add both your request & a request I had to add the option for retweets to be displayed.
I am currently adding the retweet option, but the ability to hide/remove @replies has so far eluded me. I am not going to say it’s impossible, because it isn’t, but getting it to work in a practical mannor is lost on me.
Basically the problem is that you have to ask Twitter for a certain amount of tweets, let’s say 20. Now we take those tweets and remove the @replies, let’s say there were 8 of them (that isn’t the hard bit). Here is the problem, we now only have 12 tweets when the user asked for 20. This problem could become recursive should I attempt to correct it.
The only solution I have come up with is to request 200 tweets all the time, remove @replies & then count out the amount requested. The problem with that is that getting & parsing 200 tweets takes too long.
If any coders are reading this & can think of a better solution, please let me know. Sorry Jon. I will keep trying, but so far I’m not having much luck.
I fixed up the “Your Twitter stream could not be collected. Normally this is caused by no XML feed being returned. Why this happens is still unclear.” message by changing the protocol of the twitter url to be http instead of https.