My Geek Finds
 

Sociable Wordpress Plugin

by Hersey on Apr.10, 2009, under Cool Stuff, Tools

This afternoon I installed a Wordpress Plugin called Sociable that automatically adds icons that link to different social networking/bookmarking sites such as Twitter and Facebook to post. Neat little tool since it allow people to share your post with others on these networks by basically just clicking on the icons. Just check out the Share & Enjoy icons at the bottom of this post.

I regularly post to Twitter and it updates my Facebook status. Anyway the Sociable plugin works well but I found another version Sociable-Italia that has a feature that creates TinyUrls to help you keep to the 140 character limit of twitter. Other than TinyUrls and the settings page being in Italian in Sociable-Italia, I think the plugins are basically identical.

Anyway I added the code that generates the TinyUrl from Sociable-Italia to the Sociable plugin by editing sociable.php in the wp-content/plugins/sociable directory. Find the line

$url = $site['url'];

and add this after it

if ($sitename == ‘TwitThis’) {
$twitperma = file_get_contents(‘http://tinyurl.com/api-create.php?url=’.$permalink);
$url = str_replace(‘PERMALINK’, $twitperma, $url);
} else {
$url = str_replace(‘PERMALINK’, $permalink, $url);
}

I also added the title of the post to the twitthis icon. Find the line:

‘url’ => ‘http://twitter.com/home?status=PERMALINK’,

and change it to this

‘url’ => ‘http://twitter.com/home?status=PERMALINK :: TITLE’,

Of course if I have to update the plugin in the future this will stop working unless I remember to redo this, perhaps the author of the plugin will add this to a future release.

Great little plugin – download it here.

Share and Enjoy:
  • Digg
  • Facebook
  • del.icio.us
  • Mixx
  • Google Bookmarks
  • Technorati
  • LinkedIn
  • Twitter
:, , , 177 views

3 Comments for this entry

  • Michael Hyatt

    This was hugely helpful. I tried to convert it to work with tr.im, but evidently I am not getting the api call quite right. It literally hangs my whole blog. I have gone back to TinyURL. It is working like a charm!

  • Hersey

    For tr.im I think you just need to replace ’http://tinyurl.com/api-create.php?url=’.$permalink with ’http://api.tr.im/api/trim_simple?url=’.$permalink in the file_get_contents call.

    If you have a username and password for tr.im try this
    ’http://api.tr.im/api/trim_simple?url=’.$permalink.’&username=yourtrimusername&password=yourtrimpassword’

    If you try it and it works, let us know.

    Thanks
    Hersey

  • Hersey

    FYI – went ahead and tested using tr.im – works with out username and password, don’t have an account so I didn’t try that.

Leave a Reply

Spam protection by WP Captcha-Free

Looking for something?

Use the form below to search the site:

Still not finding what you're looking for? Drop a comment on a post or contact us so we can take care of it!

Visit our friends!

A few highly recommended friends...