Saturday 14 January 2012

Add Twitter Button in HTML - No Java Script - WordPress Blogger

Twitter Buttons usually come in Java Script form, which can slow down your page load time by a small amount, but HTML scripts have no such disadvantage, so why not use HTML for your Twitter Button either in WordPress hosted blog or website or even in a Blogger Blog.



This HTML Code has a few advantages -


  1. Faster Page Load Time.
  2. Shows number of times a Page was Tweeted.
  3. Recommends up to two Twitter Accounts to everyone who tweets using this Twitter Button.
  4. Shortens all URLs to the standard t.co format.
So why wait,  I am sure you are excited to get the Twitter HTML codes, here they are -

1) For Self Hosted WordPress Blog - Just Insert this code anywhere in your Template, the place where you want to Twitter Button to be seen.


<div align="left">
<a href="http://twitter.com/share?url=<?php echo urlencode(the_permalink()); ?>&amp;text=<?php echo urlencode(the_title()); ?>&amp;via=myaccount1&amp;related=myaccount2">Tweet this Article!</a><br><div style="clear: both;font-size: 7px;text-align:left;"><a href="http://product-reviews-prices.blogspot.com/2012/01/add-twitter-button-in-html-no-java.html" target="blank"><font color="black">[HTML Twitter Button]<font></font></font></a></div></br></div>



2)For Blogger Blogs - Just Insert this Code just before <data:post.body> or just before the footer of the Blog, while in Edit HMTL tab.



<a expr:href='"http://twitter.com/share?text=" + data:post.title + "&amp;url=" + data:post.url + "&amp;via=myaccount1&amp;related=myaccount2"'>Tweet this!</a><br><div style="clear: both;font-size: 7px;text-align:left;"><a href="http://product-reviews-prices.blogspot.com/2012/01/add-twitter-button-in-html-no-java.html" target="blank"><font color="black">[HTML Twitter Button]<font></font></font></a></div></br>

Remember to change "Myaccount1" and "Myaccount2" to your two Twitter Usernames, that you want to recommend when someone tweets your articles.

That's it, now you get a fast loading Text Button for a Tweeting option in your Blog Posts.I recommend you use Floating Sharing Buttons.
Gautham On Google+

Get free daily email updates!

Follow us!





Meet the Author

Gautham A S

Gautham A S is a personal tech columnist and blogging expert at TechGau.Org, one of the leading Tech, How-To and Blogging Tips blogs