Twitter is all the rage these days and it doesn’t seem like it will be going anywhere any time soon.  With that said, it often surprises me that many WordPress blog owners  don’t offer a convenient way for their readers to retweet their content.  Anyone can grab a Twitter WordPress plugin to tweet their new content as it is published, but what about your older content?

Rather than passing up all that potential traffic, I’ve found that offering a link somewhere within your post (optimally at the bottom of each post) is a great way to help your readers and incoming search engine traffic to promote your content for you.  When people find great content they like to share it with others, so why not make it easy for them?

Not only is adding a “Tweet This!” link a great choice, but it is really easy to do.  Chances are if you do a search on Google for code to use you’ll find something like the following:

<a href=" reading <?php the_permalink(); ?>" title="Click to send this page to Twitter!" target="_blank">Tweet This!</a>

This code works just fine, but is not the most optimal solution in my opinion.  Depending on the permalink structure your WordPress blog uses, combined with the length of your domain name, it may be difficult to fit the link into a 140 character tweet.  It also doesn’t leave room for the person to add their own comments to the tweet.

As a proposed solution, I recommend using some WordPress code like the following:

<a href=" @HackWordPress <?php the_title ();?> <?php echo get_settings('home'); ?>/?p=<?php the_ID(); ?>">Tweet This</a>

This code will automatically insert the “RT” and your Twitter account name (the above example uses our Twitter account, @HackWordPress) then use the ID form of your post with the tweet.  When people click the link in the tweet, they will then be redirected to the actual post using your blog’s selected permalink structure, making a convenient and typically short URL.

Have you integrated Twitter into your WordPress blog? Share your strategies in the comments!

Kyle Eslick is WordPress enthusiast who took his passion for WordPress to the next level in 2007 by launching as a place to share hacks, tutorials, etc. Follow Kyle on Twitter @KyleEslick!

  1. Mike says:

    Seems nice idea and can be tried, right now i used plugin and keeps increasing one by one whenever any one retweet the posts

    • Yes, I’d like to use Tweetmeme in websites. But it may cause to load many javascript file, so the method described here is another solution.

      PS: I’d like to use the shortlink of post instead of its permalink:

    • Ally says:

      Thanks for the advice, Mike! I just installed the TweetMeme plug-in to my wordpress site. If I had know it was so easy, I would have done it months ago.

  2. I’m using both TweetMeme and my own “tweet this” snippet of PHP code very similar to your solution, Kyle.

    <a rel="external nofollow" href=" @iBizAcademy blog post ?>”>Tweet it

    This can also be viewed here:

    Another reason I opted to use the post ID, instead of the full URL, is that way it acts as a kind of URL shortener, while still giving me the most Google juice. Besides, think about a possible scenario: and Co. go out of business and all your shortened links are dead.

    Looking forward to more great tips from you!

  3. Luis says:

    I was having problems with other code snippets, I think because I’m on WordPress MU. Your solution worked awesomely with my site, hope this help others.

  4. Alexandra Mizenko says:

    This has really got me thinking. Thanks for that. I am really looking forward to revisiting this site 🙂

  5. Jack says:

    I tried to add this to a blog post of mine on the British Pathe blog – – but it didn’t work. The code just shows up within the blog post.

    You haven’t said where to put this code and how to make it work?? Sorry if this site is for experts who already know these things.



    • Kyle Eslick says:

      Hi Jack,

      I apologize if the post wasn’t clear. Truth is, it can be placed wherever you want it to display on your website!

      It sounds like you may be placing it within the post loop instead of above or below it, although this can vary greatly based upon how your theme was designed. Try placing it above or below the div that has “the_content”, not within the div. That should hopefully help.

  6. Emilio Breed says:

    Cheers for making this post. Could prove to be useful to me.

  7. William M. Felix says:

    Cool tips. I already add it into my site and change it into my twit account. My question is now, do you have any button for change the ‘tweet this’ text?

    Thank you. 😀

  8. sam says:

    Very nice HTML work actually HTML work is mainly for the blogger. very good information how to add a twitter link to yahoo meme..thanks for providing..

  9. Deepanshu says:

    well it works but it only gives a simple text stating tweet this without displaying any button which doesnt look nice 🙁 how to insert a button….i managed it for fb like button using this code 🙂

    <iframe src="; ?>&layout=standard&show_faces=true&width=450&action=like&colorscheme=light” scrolling=”no” frameborder=”0″ allowTransparency=”true” style=”border:none; overflow:hidden; width:450px; height:60px;”>

    how can i do it for twitter….i would love to get rid of another plugin 🙄

    figured out 🙂

    <a href="; ?>&via=crackentrance&count=horizontal” class=”twitter-share-button”>Tweet

    edit :

    <a href="; ?>&via=crackentrance&count=horizontal” class=”twitter-share-button”>Tweet

  10. Oris WilliamsF1 says:

    it works but it only gives a simple text stating tweet this without displaying any button which doesnt look nice how to insert a button….i managed it for fb like button using this code

  11. Nick says:

    Thank you Kuldeep, I understood the code and I have used it on my site too!
    Brilliant work keep it up.

Trackbacks/Pingbacks »

  1. How To: Add a Twitter Link to Your WordPress Blog | Wordpress Blog Hosting says:
  2. TECHFLAPS - Waves of Technology | 10 Extremely Useful Wordpress Hacks says:

Tweetbacks »

  1. seb_st (Sebastian) says: