Getting on a little bit of a technology bent lately…
There are tons of plugins you can get for your website or blog that allow your readers to share your posts on a number of social network sites. But my experience has been that often those plugins can cause havoc on your servers for one reason or another – or bog your site down in general.
But there are alternatives to using plugins — and these will work for WordPress site, or anywhere on any site that utilizes PHP.
So here are a few of the “hacks” that I’ve added to my site (thanks to Vandelay Design for several of these):
E-mail this
This code will give your readers the ability to quickly e-mail a link to your post or page. For WordPress add it to your single.php file, or page.php or any other pages you’d like folks to be able to share.
<a href="mailto:?subject=<?php the_title();?>&body=<?php the_permalink() ?>" title="E-mail this
article to a friend!">E-mail this</a>
Share on FriendFeed
Allows your readers to quickly share the link within their FriendFeed feed. Hopefully spurring on more conversation and click backs.
<a href="#" onclick="var e=document.createElement('script');e.setAttribute('type','text/javascript');e.setAttribute('src','http://friendfeed.com/share/bookmarklet/javascript?url=<?php the_permalink() ?>&title=<?php the_title() ?>');document.body.appendChild(e); return false;">Share on FriendFeed</a>
Share on Twitter
Opens Twitter in the browser window and shares a link, along with “Currently reading:” If you’d like to change the pre-text on the tweet, you can do so easily within the code.
<a rel="nofollow" href="http://twitter.com/home?status=<?php echo urlencode("Currently reading: "); ?><?php the_permalink(); ?>" title="Share this article with your Twitter followers">Tweet this!</a>
UPDATE: I’ve now added an additional “feature” to the Tweet this link. The link will also tag my Twitter name @jdblundell in the Tweet as well. So it looks like this:
Currently reading: http://www.casadeblundell.com/jonathan/reflections/the-dream-of-whats-next/ from @jdblundell
To add your Twitter name, simply add this code within the a href tag:
<?php echo urlencode(" from @jdblundell"); ?>
So the code ultimately looks like this:
<a rel="nofollow" href="http://twitter.com/home?status=<?php echo urlencode("Currently reading: "); ?><?php the_permalink(); ?><?php echo urlencode(" from @jdblundell"); ?>" title="Share this article with your Twitter followers">Tweet this!</a>
(of course be sure and change the Twitter name from mine to yours – would hate to get credit for all your great posts :-)).
Now if I can just figure out how to use the built in “Get Shortlink” feature on WordPress 2.9 vs the “Get Permalink”…..
So there you go, there are three social media hacks I use. You can also set some up with Digg and other sites, but I’ve never been too fond of Digg myself, so I don’t use it.