Share This Post on Twitter
It is surprisingly simple to add a little bit of code to your website to allow for sharing of posts on Twitter.
In WordPress using
the_guid functions you can build a dynamic “retweet” link for each post that works on your home page and on individual post pages.
The code I’m using here looks like this:
<a href="http://twitter.com/home?status=<?php the_title(); ?> - <?php the_guid(); ?> (via @shawnblanc)">Retweet.</a>
The advantage of using
the_guid instead of
the_permalink is that it’s the shortest URL your WordPress site automatically generates. And assuming you use clean, human-friendly, URLs set in your WordPress preferences, these post ID URLs will simply re-direct to your desired permalink.
For example, below are two different yet legit URLs for my review of Yojimbo. The first one is what’s generated using
the_guid and the second is the actual permalink URL and is what’s generated using
The second link, which is the standard, permalink address to the Yojimbo article is more human friendly and makes for better search results. However, it also has 29 more characters than the first link listed. The second link is best for normal use, the first is best for Twitter.
What I like about this way of implementing a Twitter-sharing feature is that it uses plain and simple code, rather than a plugin. Plugins are great, but I like to keep their usage here to a minimum.
I have yet to see anyone really use these Twitter-sharing links yet. In the past few weeks of testing this, I’ve seen amongst my own little readership that people are much more inclined to re-tweet something already tweeted. Which leads me to my next point…
For months now I have been finding the most interesting news and best reads via Twitter (much more than via my RSS feeds). Even though much of the content I’m being told about in Twitter is the same content that’s being delivered to my RSS reader, I interact with Twitter much more than my RSS feeds.
And so I assume it’s more than likely that you’re doing the same. There will certainly some overlap for those of you who follow me on Twitter and get my RSS feed, and if that bugs you I am sorry. Nearly every RSS feed I am subscribe to I also follow the author on Twitter, And I have never once been bugged to see them plug their own content.