Add Facebook “Like” to your Website in One Step [Super Quick Guide]


I was pretty Much Excited to Hear the News that Facebook has started the Concept of “Universal Like”.

Universal “Like”??
As The Name Suggests, You could like anything and everything on Web.. The Best Part here is Whatever you “like” on Website will be Streamed into your Facebook News Feed! What’s More! You could share things even without logging into Facebook account.. “Like” it??

Integrating Facebook “like” feature in your WordPress Blog.

I Visited Facebook’s developer page to Check out how to integrate the Like button to my Website.. Though in that OpenGraph page they have explained very neatly, I was Searching for a Very Simpler way to add a Like Button to Website.. Here Goes the details..

If you are a WordPress User Just Copy the below IFRAME Code.. Go to Your Themes and find the single.php and dump it where you would like to have the button ( before the post / after the post)

<iframe src="http://www.facebook.com/plugins/like.php?href=<?php echo urlencode(get_permalink()); ?>&amp;layout=standard&amp;show-faces=true&amp;width=530&amp;height=60&amp;action=like&amp;colorscheme=light" scrolling="no" frameborder="0" allowTransparency="true" style="border:none; overflow:hidden; width:530px; height:60px"></iframe>

On Successfully inserting the above code in single.php you could see the facebook like button on every individual posts. If some one likes your post, the title of post is posted in their Facebook’s News Feed. Its all due to power of get_permalink() in the code!

For Thesis Themes on WordPress
Are You Using Thesis Theme, and Cannot Find single.php to insert Facebook like code?

Just add this code at the end of custom_functions.php file

function add_like() {
 
if (is_single()) { ?>
<iframe src="http://www.facebook.com/plugins/like.php?href=<?php echo urlencode(get_permalink()); ?>&amp;layout=standard&amp;show-faces=true&amp;width=530&amp;height=60&amp;action=like&amp;colorscheme=light" scrolling="no" frameborder="0" allowTransparency="true" style="border:none; overflow:hidden; width:530px; height:60px"></iframe>
< ?php
}
}
add_action('thesis_hook_before_headline', 'add_like');

I have Used the thesis hook thesis_hook_before_headline to make appear the like button below headlines of every post...
Other Suggested hooks are
thesis_hook_after_headline
thesis_hook_before_headline
thesis_hook_after_post_box
thesis_hook_before_post_box

To Learn More about Like button customization and to generate like button of your choice check facebook like plugin page..

Hope the Post was helpful... Let Me know if you have any Doubts in Integrating facebook like button for your web page. Tweet me @che2on