<< 21 step system that gets you $1000, $3000 , $5000 commissions per sale >>

Tweet This Post Without The Plugin

written by John Chow on January 25, 2009

Secure Affiliate Marketing

I’ve received quite a few emails asking how I modified the Tweet This WordPress plugin to make it performed the way that I wanted. I was going to write a little tutorial on it but then @Marhgil over at Macuha.com informed me that I could have created the Tweet This link without a plugin.

Because I only wanted to insert the Tweet This link at the bottom of my posts and didn’t needed any of the other features the Tweet This plugin offered, it would just be a simple matter of adding one line of code to the single.php file. Marhgil explained how he did it here. I made a couple changes to clean up the codes a little.

<a rel=”nofollow” href=”http://twitter.com/home/?status=Reading @JohnChow – <?php the_title(); ?> http://johnchow.com/?p=<?php the_ID(); ?>”><img src=”http://www.johnchow.com/images/tweet-this.png” alt=”Tweet This” /> <strong>Tweet This Post!</strong></a>

Insert the above code (change to your domain and twitter name) to your WordPress single.php file at the point where you want the Tweet This link to show up. In my case, I have it appear right after the post.

You will noticed that the link uses the default WordPress URL structure of http://johnchow.com/?p=xxxx instead of the SEO friendly URL. Doing it this way will allow you to bypass the use of an URL shorten service. JohnChow.com only has one more letter than TinyURL.com so this isn’t a big deal. What is a big deal is the URL has my domain name in it and reinforces my brand. You can save yourself a few letters by using www instead of http:// as Twitter.com will auto link the URL. However, Twitter clients like TweetDeck will not link the URL if it’s missing the http:// so I recommend you stick with it.

You won’t have to worry about readers getting to your blog using the default URL because WordPress will auto forward them to the SEO friendly URL. I added a ref=nofollow tag to ensure that no Google juice is passed to the short URL.

The advantage of using a line of code instead of a plugin is less overhead. A simple line of code consume less resources than an entire WordPress plugin so your blog should run faster. The other advantage is using your own domain in the short URL to help reinforce your brand.

Did you enjoy this post? Get John Chow Dot Com updates via email...

Stay up to date with all of John Chow’s tips for making money online and blog posts by subscribing via email. Your email will be kept private and never shared with anyone.


Twitter Banking January 25, 2009 at 4:01 pm

haa cant believe they had a plugin for such a simple line of code – well its less stress on wordpress backend I guess

Chris Jacobson January 25, 2009 at 8:02 pm

Thanks for this. Got the code installed, up and running already!

Terra Andersen January 25, 2009 at 8:24 pm

Your personal brand is so important when working on Twitter. So many people are clicking through thousands of links per day on Twitter, most being shortened URL’s that they easily forget where they’ve been after just a few hours.

Great tip John!

Richard X. Thripp January 30, 2009 at 5:15 pm

Tweet This is now 463 lines of code. That means it’s 463 times better, right? :-p

Anyway, the plugin is preferable if you want to use TinyURL or other services because it caches URLs instead of constantly hitting the external server, and it lets you change the text, URL services, and display options without touching your theme.

Marketing Business Review February 4, 2009 at 10:54 pm

You are right and I think it less messy if you forget anything in the lines of code.

Steitiyeh January 25, 2009 at 4:05 pm

Thanks John for sharing, i was facing couple of problems with the plugin itself and i deleted it an hour ago!

Aaron from TechThinker.com January 25, 2009 at 4:07 pm

I really like the idea of using a code snippet instead of a plugin. Its cleaner and easier to manage.

It is a clever idea to use your own short blog url rather than using a URL from a another service.

Thanks for sharing this tip.

Taris Janitens January 25, 2009 at 4:13 pm

Thanks for othe useful tutorial! I’m sure all the twitter users will be able to make good use out of this!!

Ryan January 25, 2009 at 4:21 pm

Thanks John for the great tip. If I needed to use a URL shortener, where could I find info on doing it?


Best Culinary Schools January 25, 2009 at 5:03 pm

This is just perfect! Thanks for sharing, John.

Shanker Bakshi January 26, 2009 at 6:03 am

Cooking School -whats that YAN

Reyn Aria January 25, 2009 at 6:21 pm

Why didn’t I think about that before… That’s clever. Thanks John.

Earn Extra Money Online January 25, 2009 at 6:36 pm

Great little tutorial for people not used to coding!

Marketing Business Review February 4, 2009 at 10:56 pm

Sometimes I get problems with coding and like to use plugins, but it is great to have another way to do it if anything else fails.

Money Is Everywhere January 25, 2009 at 7:27 pm

Thanks for the this nice piece of code.

erik burkhardt January 25, 2009 at 7:29 pm

Your blog is without a doubt one of the most informative and helpful blogs out there. I truly appreciate your content. I am always trying to look to improve my knowledge and strategy to make my own business stronger. I am never disappointed when I come here. Thank You and Keep up the good work

[email protected] January 26, 2009 at 5:17 am

This one is very much true. If we did not get the food for our mind than John do not forget to add some photos of delicious foods.

But this plugin is really beneficial … I will give a try at my blog.

Shanker Bakshi January 26, 2009 at 6:08 am

Hey Zubin – I can see a lot of Tweaking of WP on your site these days. it seems you are lovin it.

TYCP Entertainment Magazine January 31, 2009 at 3:12 am

Agreed. I like that he gives you info straight up with no BS.

game-girl January 25, 2009 at 7:44 pm

Greatnees is always simple.Good idea to apply it widely.

Monty - Sensonize.com January 25, 2009 at 8:24 pm

Thanks for this, i’ll try it today :)

marhgil January 25, 2009 at 9:11 pm

thanks for featuring the code! i overlooked putting the nofollow tag, i’m adding it on my code now. now, i’m preparing my blog for a John Chow effect. :) thanks for the link!

Shanker Bakshi January 26, 2009 at 6:09 am

You must get ready for this – It would be your Lucky day today Marhgil. See the visitor graph popping sky high.

Glenn January 26, 2009 at 7:59 pm

congrats marghil, nice wordpress code :)

Millionaire Acts January 28, 2009 at 7:34 pm

Wow, I hope one of my posts will also be linked by John Chow. Congratulations Marghil! Definitely that would mean more earnings for you. :)

noel (work at home dad) February 3, 2009 at 5:48 am

ah..preparing the blog….increasing your server resources temporarily ey! :D

RTFVerterra June 13, 2009 at 3:31 am

Marhgil, you’re the man

RTFVerterra’s last blog post: How Free Kaspersky Antivirus with Serial Saved Me

Dan January 25, 2009 at 9:55 pm

I saw the @Marhgil tutorial and added it to one of my blogs.

I did add a hashtag to mine, had to use %23 for the # sign or else it was dropped by twitter.

reflux January 25, 2009 at 11:26 pm

I am not yet join the twitter…..I think, above is great information, thanks john

gladys_cute January 25, 2009 at 11:52 pm

Can I add this in my photo-gallery-based blog? I want to share my sexy pics for all over the world. Can I?

SEO Tips January 26, 2009 at 5:36 am

Thats excellent I shall be trying that out soon. Looks much cleaner.

Shanker Bakshi January 26, 2009 at 6:01 am

Cool Tool, indeed.

Money Money Money January 26, 2009 at 8:48 am

Ill shall wait for social bookmarking sites to add this to their options.

Ruben Ricart January 26, 2009 at 8:58 am

I was wondering about the same thing but did not ask the question – thanks for sharing…

100wordrants January 26, 2009 at 9:59 am

Simplicity at its finest! Thanks John!

Guru Assassin January 26, 2009 at 1:06 pm

This is really useful for me. Thanks for sharing the code. I’d love to know how to code.

Eligio January 26, 2009 at 3:29 pm

nice little line of code, this can be also use in any website that need to be broadcast in twitter. thanks for sharing :D

Andrew January 26, 2009 at 5:41 pm

Any ideas on how to add a tweet this button to the homepage of a html site while keeping the shorturl feature? I’ve been looking everywhere for this and haven’t been able to find anything. Thanks for any help.

Article Spinning January 26, 2009 at 9:47 pm

Interesting, thanks for sharing this, John.

game-girl January 26, 2009 at 10:24 pm

Nowhere else I could find such easy and interesting ideas.

Will Lowrey January 27, 2009 at 8:15 am

For those out there using the Thesis theme, here is a way of adding the same thing without editing the core files in the template.

function custom_tweet_this() {
<a rel=”nofollow” href=”http://twitter.com/home/?status=Reading @WillLowrey – http://online-profit-center.com/?p=“> Tweet This Post!


add_action(thesis_hook_after_post, custom_tweet_this);

Add it to your custom_functions.php and you are good to go.

Reyn Aria January 27, 2009 at 9:17 pm

I managed to make some adjustments so that the bird pic is a bit transparent and will fully visible upon hovering. No need to install the plugin as well. You need to take the pic from the Twit This plugin though.

Put this in style.css file:

background:url(images/tweet-this.png) no-repeat 0px 0px;
height: 60px;
width: 60px;
margin:0px 0px 0px 0px;

background:url(images/tweet-this.png) no-repeat 0px -60px;
height: 60px;
width: 60px;
margin:0px 0px 0px 0px;

Put this anywhere inside the single.php file:

<a rel=”nofollow” target=”blank” href=”http://twitter.com/home/?status=Reading @Reyn Aria – http://MyNetworkMarketingBlog.com/?p=” title=”Post to Twitter ()”>

Change as necessary…

shun2u January 27, 2009 at 10:22 pm

Thanks. Will insert the code. :)

Jehzeel Laurente January 28, 2009 at 11:31 am

wow! marhgil’s twit this code was indeed featured here! yay!

The Blogger Source January 28, 2009 at 11:10 pm

I see John uses Tweets on his blog but I am a bit hesitant as it will clutter up the site. Do you really gain anything?

Candace Robinson January 29, 2009 at 1:03 pm

Marvelous! It took some work but it’s working! Thank you.

diabetes man January 29, 2009 at 10:43 pm

thanks for good news john……

TYCP Entertainment Magazine January 31, 2009 at 3:01 am

Yep, this is the kind of code I have going on one of my sites. The only difference is I don’t have the big bird next to it, just the small “t” icon. Either way, the code works out way better than the plugin.

qarla January 31, 2009 at 6:28 am

Macuha rules!

peter February 1, 2009 at 1:00 am

hey i would love to get this thing to work but for some reason it displays one of my blog urls and then a weird question mark symbol then the twitter url, when i click it it just loads some other post on my blog… any ideas? thanks.

Steve May 22, 2009 at 6:15 pm

I’ve got the EXACT SAME ISSUE! Can someone provide any ideas?

helmiasyraf.com February 1, 2009 at 10:06 pm

Such a great help for me personally. I really looking for this kind of tutorial coz I have problem in getting sufficient traffic for my site. This can be handy though.

The best thing about it is it will let our blog run faster as compared if we used common widget/plugin. This will definitely will solve my slow-loading blog (n_n)

jsonvega February 1, 2009 at 11:23 pm

thanks! it works great! rock on!

Lucia February 3, 2009 at 10:52 pm

Love this! How can I do this using Blogger?

Work At Home Blog February 9, 2009 at 9:02 am

I learned it from another blog and I installed it on my blog but with a different image. I’m just thinking if I should change the image to the bird pic.

Peter Lee

Gagan February 20, 2009 at 2:45 am

all i can is THANKS

Steven Lewis February 21, 2009 at 2:28 pm

I enjoyed this article because I recently started using the “Tweet This” plugin on my blogs. It does come packed with a whole lot of stuff that most people won’t even use… but I suppose it’s better to have “more” than not enough, you know. ;) Thanks for the info… it’s going to come in handy for customizing my future blogs.