Adding The Twitter Button to Your WordPress Blog

Twitter today released their Twitter Button and until release of a WordPress pluginĀ ( I have written a WordPress plugin )I have put together the following code to add the new button to your site.

In your theme files, simply paste the following code where you want the button to appear.

<div style="float: left; margin-right: 10px; margin-bottom: 10px;">
<a href="http://twitter.com/share" class="twitter-share-button" data-url="<?php echo get_permalink(); ?>" data-text="<?php echo the_title('','',false); ?>" data-count="vertical">Tweet</a><script type="text/javascript" src="http://platform.twitter.com/widgets.js"></script>
</div>

Note: Must be within the loop.

Thanks to TwisterMC for some amendments

2 thoughts on “Adding The Twitter Button to Your WordPress Blog

  1. Hi,

    I have been using your plugin. When we click tweet the tweet count increases, but it resets when you refresh page. If count is 0 and you click tweet it increases to 1 but when you refresh page it again displays0. can you please advise what is wrong. Following is the code we are using.

    Tweet

    Thanks and Regards,
    Alok

    • Not sure what is happening here, will look in to it. However what I can say is that all my plugin does is add the code that Twitter provide. If there is an issue at their end then I am not in control of that.

      Dan

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>