Few days back Facebook introduced a new like button. Earlier like feature was available only on Facebook but now this new button extends this feature to other websites. This Facebook like button allow users to share your content back to their friends on Facebook.
Although Facebook has provided the documentation to add Facebook like button to your website but the documentation is easier only for single page websites. The difficulty comes when we add it to blog post. We need little customization and hack for this purpose.
In this tutorial I’ll share how to add Facebook like button to WordPress blog.
How to add Facebook like button to WordPress ?
We have two methods to add Facebook like button to WordPress. One is by manually adding code into your theme file and other is by using plugin.
Open your single.php file in your theme folder and then copy and paste the following code wherever you want the code to appear:
<iframe src="http://www.facebook.com/plugins/like.php?href=<?php echo urlencode(get_permalink($post->ID)); ?>&layout=standard&show_faces=false&width=450&action=like&colorscheme=light" scrolling="no" frameborder="0"Â allowTransparency="true" style="border:none; overflow:hidden; width:250px; height:40px">
Now save your file and you are done. You can adjust the following parameters in the code:
- If you want to show the button only with button count then you can use the parameter layout=button_count instead of layout=standard.
- If you want to show the faces of your friends then you can change show_faces=false to show_faces=true.
- If you want to change the text from like to recommend then you can use the parameter action=recommend.
- If you want to use the dark color scheme then you can use the parameter colorscheme=dark.
I hope this will help you to successfully add a like button to your WordPress. If you do not want to go into coding part then you can use the method 2.
This method is easy for all of use as it requires only to install a WordPress plugin. You can easily add like button using WordPress plugin but I’ll recommend you to use the method 1. Anyways here are few plugins listed below:
- Facebook Like Button: This plugin allow you to add Facebook Like Button to your WordPress blog with a lot of customization options.
- Like: It provides many features including adjust width height, layout options, color scheme, show thumbnail of Facebook profiles and more. It also supports multiple languages.
- Facebook Like Button For WordPress: This plugin offers quick load time and also easy installation and customization features.
You can use any of the above listed methods. I’m using the first method here on my blog. Why not try this code by hitting like button at the top of this post 😀
You might also be interested in:
Add Google Buzz Button To WordPress Blog
How To Add Orkut Share Button To WordPress And Blogger Blogs ?
How To Add Floating Social Media Buttons To WordPress Blog Without Any Plugin
Are you going to add this button to your blog and which method you prefer out of the two methods listed here. Do let us know
Where i should paste the code in single.php file?
.-= TechPapa-Jokes, Humor´s last blog ..Take Credit Automatically, When anyone copies Content From Your Blog =-.
Wherever you want the code to display.
If you want to display it above the content then search for <div class="entry"> and paste the code above it.
I would probably use a plugin if I had to add a like button, otherwise I would screw up my codes 😉
.-= Shiva | Web Magazine´s last blog ..5 Tips For Successful Blogging =-.
If you are not well in editing the codes you should chose wordpress plugin only. That’s why I provided two methods.
Initially I loved the Fb share button but now since people are aware of usage of Fb like button and specially now it’s adopted the feature of Fb share button, it’s one of must have social bookmarking plugin that one should be installing.
People might be aware of FB like button now but still FB share button is also effective. I think sharing posts over FB is better than liking them.