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="https://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