Brian Cray ··· Home > Blog > Php, Wordpress > WordPress: The best tweet this link ever

WordPress: The best tweet this link ever

With the right people sharing your blog entries on Twitter, you'll receive a good amount of quality referrals. One way this occurs is a retweet from frequently retweeted people as seen here.

The other way is to make it super simple for readers to tweet your blog entry. That's where this post helps. If you have a self-hosted WordPress blog, add this code to your /wp-content/themes/[current theme]/single.php file where you want your own "Tweet This" link. [TinyURL shortening code originally from here]

$shortenedurl = file_get_contents('' . urlencode(get_permalink()));

<a href="<?php echo str_replace(' ', '+', the_title_attribute('echo=0')); echo '+' . $shortenedurl; ?>" title="Share <?php the_title_attribute(); ?> on Twitter">Tweet This</a>