=== Twitter Badge Widget === Contributors: workshopshed, 2020media Tags: twitter, widget, multi-widget Donate link: http://www.workshopshed.com/ Requires at least: 2.8 Tested up to: 3.1.3 Stable tag: 1.2 Provides a twitter badge widget that you can place on your wordpress site to display tweets from a specific twitter user. == Description == The widget requires a twitter username (screen name) and the number of tweets to display. The time that the tweet was made is formatted in a friendly style. The users, urls and hashtags are all linked from the tweets. The current version is limited to displaying between 1 to 200 tweets. The title is optional and if entered will display in the usual style for titles, it is suppressed if not entered. There are two choices of layout, a narrow format for sidebars this is the default and a wide format for a banner shaped display which can be used on the top of pages. The follow can be a simple text link or an interactive button with count. == Installation == The installation is standard. 1. Upload all the files to a new directory in the `/wp-content/plugins/` directory 1. Activate the plugin through the 'Plugins' menu in WordPress 1. From Appearance section of the dashboard select widgets 1. Drag the "Twitter Badge Widget" into your selected sidebar 1. Configure the twitter username and optionally the number of tweets and style. == Upgrade Notice == Latest release == Frequently Asked Questions == = I can't work out how to add the badge = Your wordpress theme needs to support widgets, you can tell this from the themes page of the dashboard. You should see a link to widgets from there and also in the Appearance -> Widgets shortcut menu = How do I change the graphics or appearance? = This is handled by TwitterBadge.css, TB_Wide is the wrapper for the wide style and TB_Narrow for the default style. = How can I see two users next to each other? = The widget does not support multiple twitter accounts in one list but you could put two widgets next to each other and omit the title from the second one. = It's not working.... = If you see "loading..." and nothing is ever returned then you may have a clash with Jquery. If you see "loading..." and then it disappears then it's possible there is an issue with twitter or the username supplied is not valid. If you wish to display the error message to the users then remove the style TB_Error from the CSS file. Feel free to add comments on the forum, I'm not always able to answer them quickly. == Screenshots == 1. Example of the default narrow style 2. Example of the wide style 3. Example of the interactive follow button 4. The admin UI of the widget == Changelog == = 1.2 = * Simplified the rendering function * Swaped the case of the filenames to lowercase so they work with the various minify plugins = 1.1 = * Refactored the rendering of the Widget UI to use functions rather than mixed php / html * Fixed bug with the title section not rendering correctly. * Testing on Twenty Ten and Twenty Eleven themes and CSS changes to reflect. = 1.0 = * Implemented interactive follow button = 0.92 = * Fixed typo in Localised regional time JScript = 0.9 = * Improved Jquery handling * Improved Jscript handling = 0.8 = * Added a loading graphic using the stylesheet. * Added localised version of the relative time function * Also regionalisation support in the UI and widget form. * Minor CSS fixes = 0.7 = * Put the inline JScript into a comment block (best practice) but I'm not actually aware of any browsers that would have an issue with it. * Split the rendering out into a separate function and processed it using add_action/do_action 'TB_RenderWidget', this should help if people want to extend or override the widget's rendering * Minor CSS fix for position on Wide format = 0.6 = * Added the &trim_user=true and &include_entities=false parameters onto the JSON call, this means less data is returned and hence it should display faster = 0.5 = * Restructure Widget code to have all rendering code together. Will make easier to add shortcode support. * Moved styling from JS to CSS where it belongs. * Improved checking on parameters * Support for more than 20 tweets = 0.4 = * First release version == Rate limiting == Twitter will limit to 150 requests per hour, that means that each visitor to your site will be able to view 150 pages on your site each hour before the status will stop updating. Check your hosting stats to see if that's likely to be an issue. "The REST API does user and IP-based rate limiting. Authenticated API calls are measured against the authenticating user's rate limit. Unauthenticated calls are deducted from the calling hosts IP address allowance." See: http://dev.twitter.com/pages/rate-limiting Practically this should work for most kinds of site, perhaps if you are hosting a forum or very interactive site where the user might be visiting many sites then you would be better of with the Wickett Twitter widget. That widget calls the API from your site and hence uses your quota, it does however cache the results to ensure that it's not making too many calls per hour. == Regional Support == The plugin and javascript has been coded to support different regional languages, however the langage files have not been created yet. The interactive follow button is provided by Twitter and supports a reduced number of languages. Let me know if you are interested and we can work together to make it work in your language. == Technical section == It uses the Twitter API and as it's only accessing tweets and is read only it does not need authentication. http://api.twitter.com/1/statuses/user_timeline.json The widget uses client side javascript to load the tweets. It uses Jquery to delay a call the API so it should not slow the display of your page, once the page has loaded then the javascript will call out to twitter and retrieve the values, the javascript then formats the results including links for urls, peoples IDs and hashtags. The widget supports multiple instances so you can display two different twitter streams on the same page. The visual layout is controlled with CSS so can be customised if desired. Two default graphics are supplied from the twitter buttons page. http://twitter.com/about/resources/buttons For caching JScript it should be possible to utilise Cachejs with either cookie or local store but I've not investigated that yet. http://www.puremango.co.uk/2010/05/caching-in-javascript-with-cachejs/ If you want to override the rendering totally then you need to provide a function that does the same as Render and hook it to the action 'TB_RenderWidget' The code and javascript has been localised using the relavent __() functions etc. Not actually tried changing the language yet though. == References == A selection of places I've found help for this plugin = Wordpress = * http://justintadlock.com/archives/2009/05/26/the-complete-guide-to-creating-widgets-in-wordpress-28 * http://planetozh.com/blog/2008/04/how-to-load-javascript-with-your-wordpress-plugin/ * http://www.garyc40.com/2010/03/5-tips-for-using-ajax-in-wordpress/#js-global = Twitter = * http://dev.twitter.com/doc/get/statuses/user_timeline * http://dev.twitter.com/pages/follow_button * http://twitter.pbworks.com/w/page/1779897/RelativeTimeScripts * Wickett Twitter Widget = Javascript = * http://www.diveintojavascript.com/projects/javascript-sprintf * http://mytechworld.officeacuity.com/?p=393 * http://www.simonwhatley.co.uk/examples/twitter/prototype/ = Localisation = * http://codex.wordpress.org/I18n_for_WordPress_Developers * http://ryan.boren.me/2004/11/01/localizing-plugins-and-themes/ == Enhancements == Some ideas, let me know if you are specifically interested in any of these. Support more of the parameters for the user timeline API? Support for shortcode tags? Support for other twitter APIs e.g. a user profile widget, search for a #tag or a twitter lists widget? Caching of results to reduce rate limiting issues? Include additional profile information next to the "follow" link e.g. numbers and location, 500 followers, London Split inline functions in javascript into separate functions so it's easier to enhance/tweek them Anything else? == Testing comments == Tested with IE9, Firefox 4 and the default Android browser on the HTC Wildfire. The widget uses the widget classes that were introduced in Wordpress 2.8 so it should work with any version since then. Tested on my own site with a variety of different widgets Specifically checked it with Google + 1, Contact Form 7, Google XML Sitemaps Tested with Twenty Ten, Twenty Eleven and "Emerald Stretch" theme by Nikolaj Masnikov. Tested with BWP Minify Thanks to 2020media for their help with testing.