Wordpress: Add a “Tweet This” Link to Posts
Research firm Hitwise was recently commissioned to conduct a study focused on the UK online market. Among their findings they reported that one out of every 350 visits to a UK site comes from the social networking site Twitter, making it the 30th largest source of traffic in the UK.
The report goes on to say that while only 9.5% of this traffic is driven toward commercial sites almost 56% of it goes to other social networking sites, media sites and blogs. It’s clear to see from this that Twitter can be an important source of traffic to your blog.
One of the easiest ways to allow people to share your blog posts on Twitter is by allowing them to tweet directly from your site. There are a number of plugins available to help you do this. However, here we will look at one quick and simple method that does not require any plugins to be installed on your blog.
Adding the Link to Wordpress
Step 1: Open the header.php file of the Wordpress theme you are currently using. Locate the closing </HEAD> tag and insert the following lines just before it.
<?php if ( is_single() ) { ?> <script type="text/javascript" charset="utf-8" src="http://bit.ly/javascript-api.js?version=latest&login=tweettrackjs&apiKey=R_7e9987b2fd13d7e4e881f9cbb168f523"></script> <script type="text/javascript" charset="utf-8" src="http://s.bit.ly/TweetAndTrack.js?v=1.01"></script> <?php } ?>
Step 2: Open the single.php file of the Wordpress theme you are using. Insert the following lines below the_content() function.
<a href="#" onclick="return TweetAndTrack.open(this, '<?php echo get_permalink();?>');"> <span style="display:none;">Reading: <?php the_title();?></span>Tweet This Post on Twitter</a>
Of course you can modify the final line of code to display whatever text you want your visitors to see. You can even replace the text entirely with an image file if you wish.

Programmer, web developer, graphic designer, photographer based in Ireland.
martirosyan
19 Jan, 2010
Это — позор!