With all the buzz lately about Twitter real-time search. Why don't you add a real-time tweets bar related to your posts from your twitter timeline or from anybody or even limit it by a geocode coordinates!
Check out These Demos..
Each one links to the demo page where you can see HTML & CSS & JS you need to use... CSS code is important but it is almost the same across those different samples, so I'm not going to focus on it here.
Demo 1: Typical Real-time related Search ►
This sample will extract tags that already exists in the page and do a typical realtime related search..
<script type="text/javascript"
src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>
<script src="http://realtime-related-tweets-bar.googlecode.com/files/jquery.relatedtweets-1.0.min.js"
type="text/javascript"></script>
<div class="related-tweets">loading..</div>
Use CSS in demo file then include jQuery and plugin JS and add a div with a "related-tweets" class and it will be auto-loaded with default options!
Demo 2: Real-time Search Limited to Some Users ►
Few options were changed here:
Limiting tweets by users like @TechCrunch and @mashable only.
Returning only tweets that have links.
Increasing entry transition time of each tweet to 500ms.
Animating text font-size instead of the default opacity animation.
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>
<script src="http://realtime-related-tweets-bar.googlecode.com/files/jquery.relatedtweets-1.0.min.js"
type="text/javascript"></script>
<div class="related-tweets" options="{
debug:true
,from_users:'TechCrunch,mashable'
,links_only:1
,animate:'fontSize'
,enter_time:500
}">loading..</div>
Div now has a new attribute (options) that contains comma delimited list of options. (a trailing comma is fatal)
Demo 3: Realtime Search Limited by Geocode of 'Mountain View, CA'►
Returns tweets by users located within a given radius of the given latitude/longitude.
<script type="text/javascript"
src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>
<script src="http://realtime-related-tweets-bar.googlecode.com/files/jquery.relatedtweets-1.0.min.js"
type="text/javascript"></script>
<div class="related-tweets" options="{
debug:true
,geocode:'37.400465,-122.073003,25km'
}">loading..</div>
Just added a geocode on the from of "latitude,longitude,radius".
To convert an address to a geocode try this and don't forget to add the radius in mi(miles) or km(kilometers)!
Demo 4: Realtime Search by All Tags ►
By default, plugin will search twitter by OR-ing those tags to return tweets with any of the tags. but you can force the search to return tweets that contain all tags.
you may also limit number of the used tags to avoid empty result set when twitter can't find tweets that have all tags on current page!
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>
<script src="http://realtime-related-tweets-bar.googlecode.com/files/jquery.relatedtweets-1.0.min.js"
type="text/javascript"></script>
<div class="related-tweets" options="{
debug:true
,animate:'height'
,or_tags:0
,max_tags:2
}">loading..</div>
you can see that (or_tags) was set to 0 to disable. and (max_tags) to 2. also animation is done by the height!
Demo 5: Just Your Twitter Timeline ►
This is a -not related not realtime- search, just your twitter feed. and using a typical Javascript call.
'status' was set to 1 to ignore tags.
'realtime' was set to 0 to stop realtime search and perform search once. and Increased 'n' which is the number of tweets to return.
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>
<script type="text/javascript" src="http://realtime-related-tweets-bar.googlecode.com/files/jquery.relatedtweets-1.0.min.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$('#rrt').relatedTweets({
debug:true
,from_users:'Mike_More'
,status:1
,realtime:0
,n:20
,show_avatar:0
,show_author:0
});
});
</script>
<div id="rrt">loading..</div>
Since It is just your tweets. you might wanna hide avatar and author name by setting 'show_avatar' and 'show_author' to 0!
Features:
Now, You've seen most of the plugin features but let me summarize it..
- Show realtime related tweets based on your post tags.
- Show your twitter timeline; related to your post or not.
- Return only tweets with links or return all.
- Limit tweets by 1 or more users. (from/to/mention users!)
- Limit tweets by a location geocode and a radius.
- Search by tags in Or-ing or And-ing mode.
- Many tweets' transition options like opacity, height, font-size.
- Each part of the tweet like Avatar, links, Hashtags.. has its own class so you can customize its style.
- Show or hide some parts of the tweet like avatar, author name, date.
- Use a typical JS call or auto-load div elements that have "related-tweets" class.
For more details on plugin options, request features or submit bugs :(
* Original tweeties icon by Chris Wallace
Thanks for these nice demos. Really useful.
@Ali, you welcome. thanks for your feedback
That's a really nice plugin.
I've done something similar, just static. Getting related tweets and putting the content on my site helps with long tail searches which bring some surprising traffic and downloads.
I suspect there would be no SEO benefit with dynamic content that doesn't have a perma-link. Still very cool though. I might use it somewhere else.
@Ian Drake,
Thanks for your SEO feedback :)
I agree that there would be no SEO benefits compared to static content that Search engines can crawl. But there is a small chance that referring to others can get them to link back to you when they check their analytics!
Still, It is more suitable to Bloggers that can only embed HTML/Javascript code on their blogs.
And more important the real-time search thing is what this plugin is all about. may be combining both sides -client & server- can be the best.
Added to TUTlist.com
Yeah man, nice post, its pretty hard to find nice posts now…
Great demo, but try to move the 'options' attribute to unobtrusive javascript, because this document does not validate as XHTML 1.0 Strict.
@Marc van Neerven,
as in demo 5?
Hi, you plugin don`t work correctly with Russian twits.
for testing: http://twitter.com/SpirITzzz
from_users:'SpirITzzz',
don`t displayed any tweets.
But from_users:'inpel' - displayed, because this user have twits in English and displayed only they.
sorry, i add lang:'ru' and it work :)
thanks! :)
but, only one twitt displayed...
@SpirITzzz,
'lang' is an optional parameter, set it to empty string '' to exclude language from the equation..
Hello mike,
Could you please tell me how can i show 3 tweets at time? i mean, each time i want to show three tweets like news sticker.
Thanks.
@deep,
It is a bar so it shows tweet by tweet.. but I'll keep this in mind for next version..
Thanks for your reply mike,
I have got the solution from here
http://tweet.seaofclouds.com/
if you would like to check it.
anyways great plug in.
@Mike It will be cool
Great plugin Mike , do you have any plans on 'styling ' it in any way ? say even as much / little as color backgrounds , borders or is this option strictly left up to the user ?
thanks @Mia,
well, every piece of the tweet content has its own CSS class so the user can customize the style easily.. check the source code of the demo links to see the used CSS.
Hi,
Been playing with this and like would I see. Very nice. Can you tell me of any disadvantages or adverse side effects of placing more than I bar in the same page? I suspect there may be some performance issues, but I'm trying to figure out if there is a problem having more than 1 '< d i v class="related-tweets" options="{...' in the same page, each with different settings. Again, I think this is great and hope to use it in a website after reviewing the usage terms and conditions.
gc
@gc,
You can place many bars with no problem.. one thing to notice in general: 'n'(Number of tweets to return) should be more than 10, so plugin won't need to auto-update results too often and get blocked by the twitter API.
Hey i've tried to hook this up to my twitter account 'lionart' but it doenst seem to like it and constantly reads loading... but seems to work fine with accounts with more tweets / followers, any ideas how to get it to work? If you can let me know and tweet me that'd be great! Thanks
@steve,
That's so weird, Searching twitter like this:
http://search.twitter.com/search?q=from%3Alionart
is not returning any tweets of yours.. seems like bug in Twitter search!
Check out this Twitter FAQ [I can't find myself in Twitter search!] in case that was the reason.
Probably you will need to contact their support
Let me know of any updates of this issue!
Sorry, just wonder whether this is for blogspot or wordpress?
@JW,
Most of plugins/widgets I've made so far are based on Javascript with or without jQuery(Javascript library). So, you can use it anywhere you can embed JavaScript code like Blogger(Blogspot), self-hosted Wordpress,..
Thanks Mike. Somehow it don't work on my blogger.
it stay at loading stage... :(
I am using Demo 1. What are the possible cause?
Thanks
@JW,
You welcome..
Could be anything! for better help, email me with more details and your site URL.
The demo is really awesome and the tweets look awesome. Thanks for the code.
tags like this "This is a tag" will be searched in its entirety. Is there a mod to break it up by space so it searches for "This" OR "is" OR "a" OR "tag" then return results containing 2 out of the 4 tags using the max tags function?
@roddyJ,
No I didn't take this case into consideration.. But will keep in mind for next version!
Great tool. THanks for making it available. Is there a way to have two items on the same page. I have done a related tweets plugin block for Chisimba using your code (see it on http://www.dkeats.com/ quite far down the right panel). I want to do a nearby tweets block, but I cannot see where I can change the DIV tag.
@Prof Derek,
This widget displays 1 tweet at a time, but since many people are asking to change that.. I'll work on that very soon :)
To set widget settings: try code in demo 2^, If things still not clear enough email me..
quick question -- how would you make it so the LATEST tweet shows up first in the realtime? mine is showing the oldest of the 10 and works it way up to the most recent... thanks,
bob
@Bob,
That sorting is fixed, but I'll try to work on that in next version!
I too am looking for a solution to the sorting option. Look forward to the update
It would be great if you could fix the fadeIn/fadeOut cleartype glitch with IE7/8. Otherwise, brilliant code.
@Robert,
Will see what I can do, thanks for your feedback :)
I have prototype running on my website and was wondering if you could provide a "jquery.relatedtweets-1.0.min.js " file that does not use the "$" shortcut. but the whole word "jquery" can anyone any suggestions or updated code?
@aLk,
There were 2 lines that didn't use the $ shortcut as it should. but that was fixed before.. If you was hosting the JS file on your space, get a fresh copy!
It is OK to use $ inside a plugin as a custom alias, See jQuery Plugins/Authoring :)
Sorry if I missed this in your description, but are the tweets displayed determined by their dates? For example, it appears the version of the routine I implemented will not show tweets from twitterers whose lastest tweets were of November or October, 2009.
Thanks.
@gc,
Can you give/email me an example of usage, or a sample URL?
Twitter accounts with recent updates appear okay.
But these (with old updates)do not appear:
http://twitter.com/AeroGrit
http://twitter.com/StimulusJobs
I don't have a published web page yet to demonstrate the problem, but if you need to see one, I will create it and send you the URL.
@gc,
which makes sense! The plugin is about realtime :)
anyway I'll see what I can do..
Thanks,
I'm not saying that the routine is broken, but would like to say to users, on good authority, that updates may not return from accounts that have been inactive for long periods of time.
Thanks for your time,
gc
LOL, so many twitter posts! I must say it does look interesting. I'm very tempted to get twitter :)
@Danny,
you should :)
Is it possible to use two instances of this script to display 2 feeds on the same page?
Its ok I got it working :) Nice plugin, thanks.
@Anonymous,
Thank you :)
That case is been taken care of on all plugins here.
This is one of the best plugins out there! And it's soooo easy to implement!!!! Thanks a lot. God bless you (or whoever you believe in)
@ciprian,
You welcome, Glad you like it.
Oh, yes. I believe in God(Jesus). And bless you too :)
Is there an easy hack to make it mark X amount of tweets as "active"?
Example:
I want to show 10 tweets simultaneously. And when it discovers a new tweet, it puts it in the two, and pushes the now 11th tweet "out of the list". A excellent example is the "Fresh Buzz" on http://cs5launch.adobe.com/
There's probably already a better jQuery plugin for it, but I haven't found it...
Great looking plug-in. Is there a way to get this to work with WordPress? I'm not a coder and just started looking at jquery today so sorry if this was a silly question
thanks @Bladeex1,
It should work the same way in Wordpress blogs(self-hosted ones!). You will need to add the plugin code somewhere in your theme files
can't for indonesian twitter
please help
How do I make the Twitter links open a new window?
I tried this, but it did not work:
$('#rrt a[href^="http://"]').attr("target", "_blank");
Great, uses this plugin for feeding news on the front page of a webpage. Works great. There is only one thing, and (as somebody mention earlier) that is when you dont update your twitter in a while.
Is there possible to display anything else instead when your feed is old? Like "I havent updated twitter in a while".
Thanks, and keep up the good work. :)
show just our timeline is not working for me.
I too seem to be receiving the same error as developing is having.
"Error:Couldn't find Status with ID=16982560548" appears when the variable 'from_users' is used. Seems to be a change on Twitter's side; as the demo (http://realtime-related-tweets-bar.googlecode.com/svn/v1/js-status.htm) doesn't work either.
Any ideas Mike? Any help would be appreciate!! :)
@undeRlIRcs,
sometime it happens and sometime it doesn't.. I think that error should not happen in frequently updated accounts. and this plugin is about realtime updates. I think that should be fixed in next version.
Thank you for the plugin!!
I see people having the same issue as me. I don't post updates very often, and as a result, my tweets don't show up. I get the "Loading..." text. You've said that it is because the code is focused on "realtime." What does that mean?
Thanks you again!
Bri
It seems that it doesn't display the tweets posted from facebook
@andrea,
Can yo show me a demo or tell me the options you are using?
sure, thanks for the quick reply!
www.twitter.com/RefoundationRec
http://www.promozoldo.it/widget-twitter.php
as you can see it displays only the tweet posted from twitter's website
(on a related note, i've created another twitter account but it doesn't show any tweet from there)
@andrea,
This plugin is about realtime updates queried from Twitter search, Which tends to ignore old tweets and some tweets from recent accounts!
You might consider using another widget for displaying your Twitter timeline.
Hi Mike, congratulations. Relly usefull and complete plugin.
just a question, is there any way to don't ignore old tweets?
thx alot
Hi Mike, great plugin! really nice work.
Just a question: what happens when the "n" parameter is bigger than the returned search? Because in the documentation you said that parameter can't be less than 20, and my user does not have many tweets to show. maybe for that reason does not work for me?
cheers
Joan
Hi Joan,
If n is bigger than returned results, plugin will show the returned plugin.. In Doc, I said don't set n less than ~10 so in realtime mode plugin won't have to update tweets too often and get blocked by Twitter API..
Also note that, Twitter search ignores old tweets and tweets from recent accounts!
Excellent! Just the ticket! Thanks. Is there any way to drop the fade transition as IE has a known bug here. I've played around with the settings, but IE won't have any of it.
Thanks @BK,
have you tried using 'animate' values other than 'opacity'.. ?
great code! thanks! question, is there a way to display multiple search results in the Typical Real-time related Search code? something like 5 lines? thanks!
@Timothy,
you welcome.. currently the plugin displays one result at a time, will change that in next version..
Mike, I also want to display tweets so the latest tweet shows first. You mentioned that the sorting is fixed and you will work on it in next version. In the meantime can I make an edit to the relatedtweets.js file to accomplish this?
@Gio,
Sorry for delayed response..
Sure you can modify the source code with compliance to the license [http://www.apache.org/licenses/LICENSE-2.0]
Thanks for sharing Mike, this is very usefull. Do you know when the next version will be available?
Hi Mike. I'm trying to use the plugin with a portuguese tweets and not works! I tried lang:'pt' and lang:''... no work! Tks
Hi @Rafael,
'lang' is an optional parameter, set it to empty string '' to exclude it..
Hi Mike,
I ran across an issue that I don't recall seeing in the past. After 2 or 3 updates, I get "Error:since date or since_id is too old". I did some Googling and it appears the issue is related to lang:en. I added lang:'' (null string) as an optional parameter and now it appears to work. Any comment?
Thanks,
George
@gcarterIT,
I saw that issue many times before and your suggested workaround looks good, thanks :)
Hey mike can you help me with this error?
TypeError: Result of expression 'jQuery('div.related-tweets').relatedTweets' [undefined] is not a function.
Hi @Cody,
have you checked your code, did you include jQuery before the plugin?
I figured it out! Thanks
Mike, just wanted to say thanks for your awesome work... will be looking forward for your next version.
i am getting this warning in chrome only "Resource interpreted as Script but transferred with MIME type application/json." I noticed it on your Twitter Timeline demo as well.
It is stuck in the loading stage... The other demos work fine but the your twitter timeline isn't.
Any suggestions?
@Cody,
that is just a warning not an error.. the timeline demo stuck in loading stage cause there were no recent tweets by me..
i'm having the same problem Cody had "relatedTweets' is not a function", and did what you said to do in order to solve the issue, but it doesn't work for me. I downloaded the js file, use a newer jquery library, but nothing works, could you help me?
Hey,
I'm having an issue where it seems to be showing the latest tweets from oldest to newest, instead of the other way around - I had read that this was fixed but just wanted to check if there is a parameter or something I need to set
Cheers,
Dan
@EC,
'relatedTweets' means the plugin JS file or jQuery is not loaded.. make sure that you have included jQuery then this plugin on the web page..
For further assistance, please mail me a sample URL
@Dan,
Tweets ordering is not changed yet.. sorry, that way it seems more logical.
Hi Mike,
Love the widget. Got it working in relatively short time.
Question i can't find the answer to in the documentation : can I user from_user, at_user and query at the same time (in one function call)? If I try, it stays on "loading.."
$(document).ready(function(){
$('#feed1').relatedTweets({
debug:1
,from_users:'railzminiworld'
,at_users:'railzminiworld'
,query:'railzminiworld'
,status:1
,realtime:0
,n:20
,show_avatar:0
,show_author:0
,lang:''
});
});
Hope to hear from you
Thanks,
Marc, The Netherlands
@Marc,
No you should not use both cause that will try to find tweets that from you and at you!
Instead, replace the 3 options "from_users,at_users,query" with this option:
query:'from:railzminiworld OR @railzminiworld'
to find tweets that is from you or at you
Hi Mike,
Thanks for your reply. I works! Thanks a lot.
Marc!
ulises:
Hi Mike. I dont know how to filter out @replies. Its is possible to do in your code? maybe in query?
Thanks in advance
@Ulises,
Twitter search doesn't provide that ability..
http://search.twitter.com
I only want to display the most recent Tweet, so I have realtime off and n set to 1 but it still flashes (loads) the one tweet over an over. Anyway to prevent this or set a check every x hours?
@Greg,
you right that should be changed, but in the mean time you can go with your idea of setting option "stay_time" to a very large number..
@Mike - Thanks for the reply and glad I could offer that suggestion! I'll try out that fix and, being only a one-page website, setting a large time should work fine!
Thanks again!
Hai Mike,
Thanks for this great plugin.
Can I limit the tweet by date? For example, I want to show the H-1 tweets from my twitter account.
Thanks
@owari,
I'm afraid Twitter Search API doesn't support that.
Is there a call back option? So if the tweets are loaded do one more function:
$('#tweetticker a[href^="http://"]').attr("target", "_blank");
this could be useful for example to make all url's to open in a new window.
@Jonas,
unfortunately not, will add this in future versions
Hi Mike.
Thank You for Your plugin!
How to show all the tweets? - For example over the past 10 days?
For example, my penultimate tweet was the 12th - now he has not shown (
Shows tweet only the last of the 17th
Regards
This plugin is about realtime updates queried from Twitter search, Which tends to some tweets from recent accounts.
You might consider using another widget for displaying your Twitter timeline like the official widget. [http://twitter.com/about/resources/widgets/widget_profile]
is it possible to add retweet and reply buttons on every tweet?
@Anonymous,
Will consider it for next version..
Nice plugin. I have this problem where it shows only one tweet over and over again. How can I fix it?$(document).ready(function(){
$('#rrt').relatedTweets({
debug:true
,from_users:'darusimws'
,status:1
,realtime:1
,n:20
,show_avatar:1
,show_author:1
,show_date:1
,show_source:0
@Daru Sim,
I tested the code and it should be working.. email me if you still have problems.
It is a great plugin. Thanks a lot, Mike.
A detail that should be pointed out is that the search API of Twitter only returns results from the last 7 days. That was driving me crazy as this plugin wouldn't return any tweets from some outdated Twitter accounts. But it ended up being this Twitter restriction, completely unrelated with how the plugin works.
Hi Mike,
Cracking plugin, very useful.
When I activate the 'show_date' option and click on the resultant link I get 'page not found' on Twitter instead of seeing the status/post. The status number generated by the plugin appears to be incorrect when compared to the actual status number. This also applies to the examples you have above.
Are you able to shed any light on this?
Regards,
Jonty
@Jonty,
That error was fixed, thanks for the heads-up..
Note that: Google Code hosting may take a while to refresh the changed script files! So, for now please include the plugin script with a dummy query param like this..
<script type="text/javascript" src="http://realtime-related-tweets-bar.googlecode.com/files/jquery.relatedtweets-1.0.min.js?temp=1"></script>
Today I bought a template Portbook. After installing and changing data in a field “from_users:” (from “twitter” to “my id”) widget ceased to display messagesr?
@Макс,
Please email me demo link or Twitter username.
Does this plugin still working with the 1.1 API Twitter ?