Are you running a hosted WordPress blog? Do you have your own, branded link-shortener? Do you use the awesome Sociable plugin? If you answered "yes" to all of those questions, we’ll show you how to strengthen your online brand with humans and search engines in a few simple steps. If you don’t have a link-shortener yet, we’ll show you how to set that up, too!
Three Reasons You should Follow this Guide:
- Strengthen Your Online Brand with Humans – your posts that are shared via Sociable will have shortened links with your domain name, not someone else’s (bit.ly, awe.sm, etc.).
- Strengthen Your Online Brand with Search Engines – see point #1. Every link to your branded URL-shortener is another link to your domain for search engines to find.
- It’s Easy – If you’re comfortable uploading files to your webserver via FTP and changing a little PHP, you can be up and running in about 15 minutes!
Set Up Your Branded Link-Shortener
If you haven’t set up your own link-shortener yet, follow the easy instructions here, first. To get the shortest URL possible, we suggest you use a one-letter directory name for your shortener.
We’ve named our link-shortener directory ‘s’ (short for ‘short’). As an example, the shortened link to the article you’re currently reading is: http://xioup.com/s/356.
Modify the Sociable Plugin (version 3.5.2)
Fair Warning: If you’re not comfortable mucking around in PHP, you may want to move on. There’s a chance you’ll break your blog or your plugin if you continue!
If you’d like to hire one of our experts to take care of this or other technical customizations to your WordPress site, contact us today!
Download the sociable.php file from your web server via FTP. You should find the file in the following directory: wp-content/plugins/sociable/ . Make a backup copy of the file with the filename ‘sociable.bak.php’ and upload it back to the sociable directory on your web server (this way you have a backup in case something goes horribly wrong). Open sociable.php in your favorite text editor.
Now you’re ready to start:
- Find the following line in sociable.php (in our copy of the file, it’s on line 744):
$permalink = urlencode(get_permalink($post->ID));
- Change the line to this (replace [Link Shortener URL] with the URL to the link-shortener you created earlier).
For xioup’s shortener, that’s ‘http://xioup.com/s/’:
$permalink = urlencode('[Link Shortener URL]'.$post->ID);
Extra Bonus: You can add ‘RT @[yourtwitteruser] ’ in front of Sociable tweets that come from your blog like this:
- Find the following line in sociable.php (in our copy of the file, it’s on line 540):
'url' => 'http://twitter.com/home?status=TITLE%20-%20PERMALINK',
- Change the line to the following (replace [yourtwitteruser] with your actual twitter user name).
For xioup, that’s ‘xioup’:
'url' => 'http://twitter.com/home?status=RT @[yourtwitteruser] TITLE%20-%20PERMALINK',
Upload sociable.php back to your web server and test that everything’s working by clicking on a few of the Sociable icons and testing the URLs Sociable is sending to the various social media services.
If you can’t get it to work, rename sociable.bak.php on your server back to sociable.php , and you’ll have your old, unhacked version of Sociable running again.
The next time you upgrade to a new version of Sociable, your changes will be lost. I keep my plugins up-to-date, so I’ll make sure to keep this post updated with specific instructions for new versions of Sociable. In other words, you should really bookmark this page
If this article was helpful, please share it with the Sociable links below. You’ll be testing xioup’s hacked version of Sociable and our branded link-shortener at the same time!