Add twitter button counter to wordpress without a plugin

By Viktor Ustijanoski | 29 December 2010

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 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=”<?php echo urlencode(get_permalink()); ?>&amp;<?php the_title(); ?>&amp;via=detectorpro” class=”twitter-share-button”>Tweet</a>
<script src=”” 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 | , , , ,

| |

One Response to “Add twitter button counter to wordpress without a plugin”

  1. The simplest way to show your twitter followers


Add to Technorati Favorites
website stats
TwitterCounter for @ukion