Tips and Tricks

August 13, 2010
 

How to get Twitter’s Official Tweet Button for Thesis WordPress Theme?

Twitter has launched its own Tweet Button service for end users as well as website and blog owners. To add this button, you just have to copy-paste the code given by Twitter team on their website.

If you are using simple WordPress theme, you can use following code to get the Tweet Button for your blog.

Get Tweet Button for Simple WordPress Theme

Code for Simple WordPress theme users:

<a href=”http://twitter.com/share” class=”twitter-share-button” data-count=”horizontal” data-via=”Harsh4d”>Tweet</a>

<script type=”text/javascript” src=”http://platform.twitter.com/widgets.js”></script>

Get Tweet Button for Thesis WordPress Theme

I’m sure many of you are looking for a simple Tweet Button code for your Thesis Theme blogs.

Go to the following URL and copy-paste the given code.

/public_html/wp-content/themes/thesis_17/custom/custom_functions.php

Code for Thesis Theme Users:

function custom_byline() {

?>

<div style=”float:right; margin-top:-17px;margin-right:-10px;”>

<a href=”http://twitter.com/share” class=”twitter-share-button”
data-url=”<?php the_permalink() ?>”
data-via=”Harsh4d”
data-text=”<?php the_title(); ?>”
data-count=”horizontal”>Tweet</a>

<script type=”text/javascript” src=”http://platform.twitter.com/widgets.js”></script>
</div>

<?

}

add_action(‘thesis_hook_byline_item’,'custom_byline’);

Note: The above code will help you add Tweet Button in Thesis Theme byline. If you want to place it somewhere else, just change the Thesis hook. You can add more properties to your Tweet Button; see here.

Also, remove the data-via = “Harsh4d” and replace it with your Twitter handle.

Also see – Get TweetMeme Button on Thesis WordPress Theme