Create Your Own Twitter Retweet Button With Counter

Before two days Tweetmeme was down and I thought why should I need to rely on external services for Twitter sharing. But I had two thoughts in my mind Tweetmeme a good services for Twitter sharing and why don’t I move for a normal Twitter sharing button. Thank God finally I got the answer from John’s little script, which uses Bit.ly’s API to count the number of share. So let me detail you about how to use that script to create your own retweet button with share count, not exactly our own.

retweet button with counter

For WordPress Blogs

Step 1: Copy the script from this URL http://ejohn.org/files/retweet.js and save the file as retweet.js and upload it on your server.

Step 2: Paste the <script src="YOUR URL LOCATION"></script> before </head> in your header.php

Step 3: In order to make the retweet button display on every post, go to single.php and paste this code

<div style='float:right; margin-right:10px;'>
<a href="<?php the_permalink() ?>" class="retweet vert self"><?php the_title(); ?></a>
</div>

Before

<?php the_content(); ?>

You are done.

Tip: If you want to add RT@your Twitter handle before the tweets. Open the retweet.js placed on your server and add search for prefix and add RT@YOUR TWITTER HANDLE within the “” (double quotes) while adding leave a space at the end before closing the quotes for eg: prefix: “RT@bloggermint ”

For Blogger blogs

Step 1: Follow the same process as I mentioned for WordPress, but instead of uploading it on server use Google code to upload your files

Step 2: Paste the <script src="GOOGLE CODE  URL LOCATION"></script> before </head> in your blogger template.

Step 3: Search for <div class='post-header-line-1'/> if you are not able to find search for <data:post.body/> and paste this code below to that

<div style='float:right; margin-right:10px;'>
<a class="retweet vert self"></a>
</div>

Save the template, thats it, you are done.

July 30, 2010. This entry was posted in Blogger, jQuery, Tutorials, Twitter, WordPress and tagged . Bookmark the permalink.

We Recommend HostGator Hosting

Bloggermint strongly recommends Hostgator Hosting for all of your web hosting needs. Sign up today for WordPress Hosting at just $4.95/month.

Use coupon code "bloggermint" to get 25% discount on any hosting packages. Get an account with Hostgator now!