Add the Official Twitter Follow Button to your WordPress Site

Twitter just launches its own official Twitter Button, and you can create your own here. It’s really simple and there are a couple of options you can pick:

  • Username to follow
  • Light or dark background color (this affects the button’s color)
  • Show follower count
  • Language

The resulting HTML example:

<a href="http://twitter.com/hafizrahman" class="twitter-follow-button" data-show-count="false">Follow @hafizrahman</a>
<script src="http://platform.twitter.com/widgets.js" type="text/javascript"></script>

Not visible on the Twitter Button page is the alternative script, using IFRAME:

<iframe allowtransparency="true" frameborder="0" scrolling="no"
  src="http://platform.twitter.com/widgets/follow_button.html?screen_name=hafizrahman&show_count=false"
  style="width:300px; height:20px;"></iframe>

You can dig deeper by reading the complete Follow Button documentation. Especially worth reading are the parameters explanation and the FAQ section.

Once you get your script you can simply paste it to your desired theme template files. A good place is the end of a post in single.php, above the comments area.

You can also add this button to your RSS feed. The simplest way is to use Yoast’s RSS Footer plugin and paste the button script there. I’m using the iframe version and it works nicely.

You may also like...

css.php