06
May
2010

Add “Tweet This Post” link in WordPress

Posted in: WordPress Tips and Tricks 1 Comment

tweet-this-post

There are few very good WordPress plugins which add a twitter like icon and link to tweet the post. But instead of using plugin, I will show you how easily you can add a link to “Tweet this post” in your WordPress blog.

You can use below code to add a link to tweet a post.

<a href="http://twitter.com/home?status=RT @techyag <?php the_title ();?> <?php echo get_settings('home'); ?>/?p=<?php the_ID(); ?>" target="_blank">Tweet This Post!!</a>

In above code, change techyag to your twitter username. When this link is clicked, visitor will be taken to twitter site and will get something like this:
tweethis

Lets go ahead and add a twitter icon instead of text link. Upload a small twitter icon names twitter.png in images folder of theme you are using. If you are using default WordPress theme, upload twitter icon in “wp-content\themes\default\images” folder. And use below code.

<a href="http://twitter.com/home?status=RT @techyag <?php the_title ();?> <?php echo get_settings('home'); ?>/?p=<?php the_ID(); ?>" target="_blank"><img src="<?php bloginfo('template_directory'); ?>/images/twitter.png" border="0" /></a>
browse premium wordpress themes

About the Author

Name: Ravi Shekhar
I love blogging and designing WordPress and Drupal themes.

One Response to Add “Tweet This Post” link in WordPress

  1. Tori says:

    You really found a way to make this whole process esiear.

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>