A simple WordPress plugin to provide integration with the Twitter API 1.1. The plugin provides theme functions and a widget to render tweets from a particular timeline feed using version 1.1 of the Twitter API.
The plugin works by making an API request to Twitter for all available tweets in a particular Twitter timeline feed. The results are then cached using the WordPress transients API and displayed to the user via a theme function or using a widget. The plugin is highly configurable and provides both design and development flexibility.
To display a tweet there are 2 main options:
$ITEM_TO_DISPLAY = 102;
$vars = array(
The above example will display item number 102 with the hash tag of ExampleHashTag. See below for more information about the specific settings.
Using the provided widget will allow for similar functionality to the theme function, you can display a specific tweet from the cached array of tweets or simply display a list of tweets.
$defaults = array(
- item_number: The item to display. If left blank the plugin will assume you want to show more then one item
- display_count: How many items you want to display.
- wrapper: A HTML wrapper element. If left blank the raw tweet text will be returned.
- hashtag: Provide a hash tag to display tweets matching the hash tag.
- referrer: Provide a referred to help with cache management. This is useful if you have lots of theme functions on a page and would like to bust the transient cache for a specific item.
- enable_cache: Enable the transient cache.
- cache_expiry: The number of minutes a tweet or list of tweets should be cached for.
- Download and install the plugin and then visit the plugin settings page.
- Visit the Twitter developer site to get an API key for your website or app: https://dev.twitter.com/
- Copy and paste the relevant info into the plugin settings and save.
- Test the plugin is working by creating a new widget or using the theme function.