Skip to main content
  1. All Posts/

twitter-tools-wordpress

Tools Open Source PHP WordPress
=== Twitter Tools ===
Tags: twitter, tweet, integration, post, digest, notify, integrate, archive, widget
Contributors: alexkingorg, crowdfavorite
Requires at least: 2.9
Tested up to: 3.0.1
Stable tag: 2.4

Twitter Tools is a plugin that creates a complete integration between your WordPress blog and your Twitter account.

== Details ==

Twitter Tools integrates with Twitter by giving you the following functionality:

* Archive your Twitter tweets (downloaded every 10 minutes)
* Create a blog post from each of your tweets
* Create a daily or weekly digest post of your tweets
* Create a tweet on Twitter whenever you post in your blog, with a link to the blog post
* Post a tweet from your sidebar
* Post a tweet from the WP Admin screens
* Pass your tweets along to another service (via API hook)


== Installation ==

1. Download the plugin archive and expand it (you've likely already done this).
2. Put the 'twitter-tools' directory into your wp-content/plugins/ directory.
3. Go to the Plugins page in your WordPress Administration area and click 'Activate' for Twitter Tools.
4. Go to the Twitter Tools Options page (Settings > Twitter Tools) to set up your Twitter information and preferences.


== Configuration ==

There are a number of configuration options for Twitter Tools. You can find these in Options > Twitter Tools.

== Showing Your Tweets ==

= Widget Friendly =

If you are using widgets, you can drag Twitter Tools to your sidebar to display your latest tweets.


= Shortcode =

Use:

`[aktt_tweets]`

to show your latest tweets. This will show the number of tweets set in your Settings. If you want to control how many tweets are shown explicitly, you can do so by adding a 'count' parameter like this:

`[aktt_tweets count=5]`


= Template Tags =

If you are not using widgest, you can use a template tag to add your latest tweets to your sidebar.

`<?php aktt_sidebar_tweets(); ?>`


If you just want your latest tweet, use this template tag.

`<?php aktt_latest_tweet(); ?>`


== Plugins ==

Twitter Tools supports plugins, several are included. You can find more here:

http://delicious.com/alexkingorg/twitter-tools+plugin


== Hooks/API ==

Twitter Tools contains a hook that can be used to pass along your tweet data to another service (for example, some folks have wanted to be able to update their Facebook status). To use this hook, create a plugin and add an action to:

`aktt_add_tweet` (action)

Your plugin function will receive an `aktt_tweet` object as the first parameter.

Example psuedo-code:

`function my_status_update($tweet) { // do something here }`
`add_action('aktt_add_tweet', 'my_status_update')`

---

Twitter Tools also provides a filter on the URL sent to Twitter so that you can run it through an URL-shortening service if you like.

`tweet_blog_post_url` (filter)

Your plugin function will receive the URL as the first parameter.

Example psuedo-code:

`function my_short_url($long_url) {
	// do something here - return the shortened URL 
	$short_url = my_short_url_func($long_url);
	return $short_url;
}`
`add_filter('tweet_blog_post_url', 'my_short_url')`

---

`aktt_do_tweet` (filter)

Returning false in this hook will prevent a tweet from being sent. One parameter is sent, the Tweet object to be sent to Twitter.

Example psuedo-code:

`function dont_tweet($tweet) {
	if (some condition) {
		// will not tweet
		return false;
	}
	else {
		// must return the $tweet to send it
		return $tweet;
	}
}`
`add_filter('aktt_do_tweet', 'dont_tweet')`

---

`aktt_do_blog_post_tweet` (filter)

Returning false in this hook will prevent a blog post Tweet from being sent. Two parameters are passed, the Tweet object to be sent to Twitter and the Post generating the Tweet.

Example psuedo-code:

`function dont_post_tweet($tweet, $post) {
	if (some condition) {
		// will not tweet
		return false;
	}
	else {
		// must return the $tweet to send it
		return $tweet;
	}
}`
`add_filter('aktt_do_blog_post_tweet', 'dont_post_tweet', 10, 2)`

---

`aktt_do_tweet_post` (filter)

Returning false in this hook will prevent a blog post from being created from a Tweet. Two parameters are passed, the data to be used in the post and the Tweet object.

Example psuedo-code:

`function dont_tweet_post($post, $data) {
	if (some condition) {
		// will not post
		return false;
	}
	else {
		// must return the $data for a post to be created
		return $data;
	}
}`
`add_filter('aktt_do_tweet_post', 'dont_tweet_post', 10, 2)`

---

`aktt_tweets_to_digest_post` (filter)

Allows you to make changes the tweets that will be included in a digest post.

---

`aktt_options_form` (action)

Allows you to add to the Twitter Tools settings page.

---

`aktt_post_options` (action)

Allows you to add to the Twitter Tools box on the New Post page (requires the option to tweet on blog posts to be enabled).

== Known Issues ==

* If you change your blog post notification tweet prefix, the previous blog post notification might not be correctly...