Artiss Twitter Data Wordpress Plugin - Rating, Reviews, Demo & Download
Plugin Description
This plugin uses the Twitter API to get basic user information. You can fetch the information using either a PHP function call within your theme or by using a shortcode in your posts and pages.
Whichever method you use there are a number of data types that you can request. These are as follows…
- name
- location
- description
- image (a 48 pixel version of the users Twitter image)
- image73 (a 73 pixel version of the users Twitter image)
- followers
- followers-sep (the same as followers but with thousand seperators)
- following
- following (the same as following but with thousand seperators)
- status (your last Tweet)
- source (where the last Tweet came from)
- url (the users homepage)
- created (the timestamp of the last Tweet)
- relative (the relative time since the last Tweet – e.g. “2 hours ago”)
- id (the URL of the last Tweet)
The plugin is also fully internationalized ready for translations. If you would like to add a translation to his plugin then please contact me
For help with this plugin, or simply to comment or get in touch, please read the appropriate section in “Other Notes” for details. This plugin, and all support, is supplied for free, but donations are always welcome.
Using the Shortcode
Simply add the following to any post or page to output one piece of Twitter data for a particular user…
[twitter user="username" data="dataitem"]
Where username
is the Twitter username and dataitem
is the data item that you require (as per the list above).
There is an additional parameter of cache
. Twitter data is cached locally for a number of hours – use this option to specify the number of hours that a cache should be used for. The default is 0.5. Specify NO
to switch off caching.
For example, to output the latest Tweet for artiss_tech and to cache it for 1 hour you would put in a post…
[twitter user="artiss_tech" data="status" cache=1]
Using the PHP Function Call
To grab Twitter data you will need to insert the following code, where appropriate, into your theme…
<?php get_twitter_profile( 'paras' ); ?>
Where paras
is a list of parameters each separated by an ampersand…
user= : This is the Twitter username
data= : This is the list of Twitter data that you wish to have returned. Each data item must be separated by a comma and should be from the list above.
cache= : Twitter data is cached locally for a number of hours – use this option to specify the number of hours that a cache should be used for. The default is 0.5. Specify NO
to switch off caching.
The following 2 parameters are only relevant to any links contained with a returned Tweet (by default all Tweets will be HTML character encoded and URLs will have links)…
nofollow= – If specified as ON
this will turn on the NOFOLLOW
attribute for the links. By default, this is switched off.
target= – Allows you to override the standard TARGET
of _BLANK
.
The Twitter data is returned in an array with the data item being the array element.
So, let’s say you want to grab the name and Tweet for artiss_tech…
<?php $return_data = get_twitter_profile( 'user=artiss_tech&data=name,status&cache=1' ); ?>
This asks for the name and status of the user ‘artiss_tech’ and makes it cache the results for 1 hour. $return_data[ 'name' ]
will now contain the name and $return_data[ 'status' ]
will contain the status.
The following is an example of how it could be used, with a function_exists
check so that it doesn’t cause problems if the plugin is not active…
<?php
if ( function_exists( 'get_twitter_profile' ) ) {
$return_data = get_twitter_profile( 'user=artiss_tech&data=name,status&cache=24' );
}
?>
Get URL References
There is an additional PHP function which will return the number of times a URL has been referenced. This will work with shortened URLs as well, so the count will reflect the resultant URL, not the shortened version. The format is…
<?php get_twitter_count( 'url', 'paras' ); ?>
Where url
is the URL that you wish to return a count for and paras
is a list of additiona parameters, each seperate by an ampersand. However, at the moment there is only one parameter…
cache= : URL reference data is cached locally for a number of hours – use this option to specify the number of hours that a cache should be used for. The default is 0.5. Specify NO
to switch off caching.
Options Screen
Within Administration and under the Options menu, there is a sub-menu option named “Twitter Data”. Selecting this allows you to specify a number of default values (namely the cache length and twitter user).
If you don’t specify either of these in the shortcode/PHP function then the value from this screen will be used instead.
Screenshots
No screenshots provided