Add twitter button counter to wordpress without a plugin
We want to add twitter count button to detector-pro posts and the easiest way to do that is with some wordpress plugin. But, with plugins you always get a more code than usual, and more and more plugins will result with slowing down your wordpress site, so we’ve decided to do that without a plugin. Looking on twitter.com for some button forms, we’ve choose button with horizontal counter. There is easy user form so you just need to select button, enter your twitter page, grab the code and put it in your wordpress template. But after that, when we check the code with w3 validator, the post page shows a few code errors. What a ….. We all know that w3 standards has important role in better page ranking and better SEO position. So, it must be followed. The page rank is important to us too, so we’ve decide to customize twitter code so it will show twitter counter button without any errors.
Here is the code:
<a href=”http://twitter.com/share?url=<?php echo urlencode(get_permalink()); ?>&<?php the_title(); ?>&via=detectorpro” class=”twitter-share-button”>Tweet</a>
<script src=”http://platform.twitter.com/widgets.js” type=”text/javascript”></script>
Change via=detectorpro with your twitter account.
Insert this code after post in single.php or anywhere where you want, sidebar, header etc… and you will get a tweeter horizontal counter with W3 validation standards.
Happy blogging.
Tags | blog, Howto, Tips and Tricks, twitter, wordpress
The simplest way to show your twitter followers