MachoArts passionately provides useful articles for Creatives. We share resources for Designers, Photographers & bloggers.

How to add Tweet or Facebook share button in Thesis

Posted in Blogging By Suraj Vibhute

Recently we shifted our blog on thesis framework, the main reason to use thesis is, it’s one of the most flexible and SEO friendly WordPress theme. I’m not an expert in PHP or CSS, but tried my best to make machoarts.com user-friendly as well as beautiful.

I thought why not to share some of the customizations I used in our theme, so from now I will try to post few simple thesis tutorials for our readers with codes and sometimes with video. Hope you will love it.

Today I am going to show you how to add Tweet or Facebook share button top right side of the post. The button will appear on single as well as archive pages.

Note: Before using these codes backup your custom_functions.php file as precaution if something goes wrong you can restore all things.

Copy this code in your custom_functions.php

/*-----------RT button-------------*/
function tweet_button_left1() {
if(is_single()){
?>
<div id='twittley_button1' style='float:right;margin-left:10px;'>
<script type="text/javascript">
tweetmeme_style = 'compact';
tweetmeme_source = 'machoarts';
tweetmeme_service = 'bit.ly';
</script>
<script type="text/javascript" src="http://tweetmeme.com/i/scripts/button.js"></script>
</div>
<?php } }
add_action('thesis_hook_after_headline', 'tweet_button_left1');
/*-----------RT button End-------------*/

Here are few things to know about about code, above code will show your compact Tweet button and if you want to show large size, then just remove

tweetmeme_style = 'compact';

From above code. Change the ‘machoarts’ with your twitter name.

If you want to show the facebook share button at the place of Retweet button, then use the below code.

/*-----------Fb Share-------------*/
function tweet_button_left1() {
if(is_single()){
?>
<div id='twittley_button1' style='float:right;margin-left:10px;'>
<a name="fb_share" type="box_count" href="http://www.facebook.com/sharer.php">Share</a><script src="http://static.ak.fbcdn.net/connect.php/js/FB.Share" type="text/javascript"></script>
</div>
<?php } }
add_action('thesis_hook_after_headline', 'tweet_button_left1');
/*-----------Fb Share End-------------*/


OK! I hope you installed the buttons. If you like our first tutorial then please feel free to drop a comment.

You can buy Thesis theme from Here.

9 comments
Alan
Alan

Awesome tut. I'm a huge fan of thesis and the modular framework that it is. I've created tons of sites using it and I'll definitely be adding your blog on my to read list. Thanks for the button too!!

Brett Widmann
Brett Widmann

This was really helpful! Thank you for the code snippets!

Richard Cummings
Richard Cummings

This is a great tutorial. I live the Thesis theme but it does make some things quite difficult. I find that the Thesis Open Hook Plugin is essential. Anyway, I will be adding these buttons on some blogs. Thx for the article, Richard

Atulperx
Atulperx

Well I am using paid tool marketmesuite now and all my tweet are from via atulperx - linking to my blog .

Thanks for your help and effort .

S.Pradeep Kumar
S.Pradeep Kumar

Nice one, will try to implement these buttons on my clients websites. Thanks for the share!!

Stephen Fleming
Stephen Fleming

Hay this video is such a fantastic.......... Such this information is really attractive and also awesome.... so thanks for this information... but now days i get the new buy scripts from the online...

Atulperx
Atulperx

Suraj bhai I am reading you blog from last few days and maybe this is my first comment here .

Well do you know how to edit twitter source options . On tweet we see that - this links was twitter by tweet meme , etc . we have many application but is it possible to display a message like - tweeted via - machoarts .