Sociable WordPress Plugin

April 10, 2009 | Filed Under Cool Stuff, Tools | 554 views 

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:
  • Twitter
  • Facebook
  • LinkedIn
  • StumbleUpon
  • Tumblr
  • del.icio.us
  • Digg
  • Mixx
  • Google Bookmarks
  • Technorati

Related posts:

  1. Sexy Unix Commands

Comments

3 Responses to “Sociable WordPress Plugin”

  1. Michael Hyatt on April 14th, 2009 1:03 pm

    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!

  2. Hersey on April 14th, 2009 3:34 pm

    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

  3. Hersey on April 14th, 2009 3:47 pm

    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

Welcome

Thanks for dropping by! Feel free to join the discussion by leaving comments, and stay updated by subscribing to the RSS feed. Enjoy!
 

Not into geek stuff? Check out The VABiker.Net or SuffolkSky.com.
 

Why not Follow Me on Twitter?

 

  • Geek Reads

     
    • VMware vSphere 4.1 HA and DRS Technical Deepdive
      This technical guide covers the basic steps needed to create a VMware HA and DRS cluster, but even more important explains the concepts and mechanisms behind HA and DRS which will enable you to make well educated decisions. This book will take you in to the trenches of HA and DRS and will give you the tools to understand and implement e.g. HA admission control policies, DRS resource pools and resource allocation settings.
       
    • Mastering vSphere 4 by Scott Lowe
      Install and manage one or one thousand virtual servers in your enterprise with the latest generation of VMware virtualization software, vSphere 4, and this comprehensive guide.

    • vSphere 4.0 Quick Start Guide
      vSphere 4.0 Quick Start Guide continues from an idea started several years ago by a few engineers. The idea was simple, provide an easy to use reference guide for all level administrators, consultants and architects.