Follow our Network


How to add Facebook Like Button in Thesis WordPress Theme

Go to (0)

Category : wordpress

Facebook Like Button

We all love the Thesis WordPress theme, and its multi-functional layout which can be highly customised. And we also love the Facebook Like button, which is in a way Facebook’s answer to the Tweetmeme button. So, why not I show you how to incorporate the Facebook Like button in Thesis WordPress button.

To do this, all you need to do is to go to your custom_functions.php file and open it in an editor. You can have a backup just in case things don’t go according to plan. Now, once you have it opened in an editor [ or in your dashboard editor ], add the following code.

function add_fb_like_btn() {
if (is_single()) { ?>
<div style="float:right; padding-left:3px;"><iframe src="http://www.facebook.com/plugins/like.php?href=<?php echo urlencode(get_permalink($post->ID)); ?>&amp;layout=standard&amp;show_faces=false&amp;width=450&amp;action=like&amp;colorscheme=light" scrolling="no" frameborder="0" allowTransparency="true" style="border:none; overflow:hidden; width:450px; height:60px"></iframe></div>
<?php
}
else  { ?>
<div style="float:right; padding-left:3px;"><iframe src="http://www.facebook.com/plugins/like.php?href=<?php echo urlencode(get_permalink($post->ID)); ?>&amp;layout=standard&amp;show_faces=false&amp;width=450&amp;action=like&amp;colorscheme=light" scrolling="no" frameborder="0" allowTransparency="true" style="border:none; overflow:hidden; width:450px; height:60px"></iframe></div>
<?php
}
}
add_action('thesis_hook_after_headline','add_fb_like_btn');

You can customise the layout of the Facebook like button by changing what I have inserted in the

Please leave a comment if it worked out for you or otherwise. And also, go ahead and hit the Like button on this post :) Cheerio!

[Image Courtesy: Venture Beat ]

Blog Widget by LinkWithin


--> Author: Sujoy

..................................................................................

<<


Post a comment