WordPress and Twitter Tools with Synected

Hi there! If you came here from a Twitter post, then you actually participated in testing these screwball modifications.

I thought I would try a couple of modifications to a couple of WordPress Plugins to add some personalization to the way posts are sent to Twitter. These modifications require the Twitter Tools WordPress Plugin and the Synected WordPress Plugin to be installed and activated on your WordPress 2.7 website. You may have to make some additional modifications if your website configuration is different from mine.

Both of these modifications are added to this website theme’s functions.php file. You could also create a custom WordPress Plugin that could achieve the same results.

Alex King’s Twitter Tools is a Plugin that allows posting and archiving to and from the Twitter micro-blogging service. Posting an article to Twitter from your WordPress website is fairly easy, but I really wanted something more personal than “New Blog Post:”, so I added the following code to modify the tweet_prefix and tweet_format $aktt object variables. You have modify both values for this modification to work.

It is important to note that Twitter Tools uses the tweet_prefix value to limit the duplication of Twitter posts when it retrieves content from Twitter, and I haven’t tested it that far yet. Ask me in a week or so. I added the 20 value just to be sure this would have a $aktt object to modify.

// Modify Twitter Tools tweet format
function funroe_mod_twitter_tools() {
    global $aktt;
    $aktt->tweet_prefix = ':P Funroe';
    $aktt->tweet_format = $aktt->tweet_prefix.': %s %s';
}
add_action('init', 'funroe_mod_twitter_tools', 20 );

The next personalization I performed involves shortening the URL that Twitter Tools posts to Twitter. Twitter can sometimes use a service like tinyurl.com, bit.ly, or is.gd to make the URL shorter for the 140 character limitation on Twitter. Unfortunately this relies on another third party website and the URL doesn’t contain anything about your website.

I came across the Synected WordPress Plugin by Tyler Shick and Jeff Smith which is designed to offer a URL shortening system for your WordPress powered website. Although the Plugin is in beta, it was easy to install and configure. I added this code to my theme’s functions.php file to use a Twitter Tool Plugin filter to create custom a shortened URL that would be posted to Twitter.

// Add hook for Twitter Tools URL shortening filter using Synected WP Plugin
function funroe_synected_url( $tt_url ) {
    $tt_synected = Synected::singleton();
    $tt_synected->create_url( $tt_url );
    return $tt_synected->short_url;
}
add_filter('tweet_blog_post_url','funroe_synected_url');

Now with both of the modifications added I can gain a more personalized integration when I post articles to my Twitter account using Twitter Tools. A typical Twitter entry should look like:

:P Funroe: The Article Title http://funroe.net/x/something

3 Responses to “WordPress and Twitter Tools with Synected”

  1. […] More:  WordPress and Twitter Tools with Synected […]

  2. […] here: WordPress and Twitter Tools with Synected » Funroe Tags:code, create-custom, gardening-what, learn, learn-what, twitter, will-need, yardiac […]

Leave a Reply