Facebook introduced more social interactions with their new “Like” or “Recommend” Button. This Facebook button enables the user to interact with a site or page. Additionally share it with his/her friends at their own Facebook profile.
Well, Facebook does made it pretty easy to Implement the “Like” button code on your site. The complexity comes when it is not a single page website. How about a blog Post? This is where you will need this hack to make it work!
Do not use the code provided by Facebook because that will not work on Blog posts. Here is the hacked code designed for WordPress!
Open up your single.php and look for the_content(). Paste the code you see below… either before or after the_content()..
// start of fb like code <iframe width="320" height="240" style="border: none; overflow: hidden; width: 450px; height: 60px;" 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" frameborder="0" scrolling="no"></iframe> // end of fb like code
Optional Settings:
If you like to show the faces of your friends, change the part “show_faces=false” to “show_faces=true”
If you like to show the label of the button as “Recommend“, change the part of the code “action=like” to “action=recommend”
I hope this will help you to implement the “Like” button on your WordPress Posts! Have fun and drop me a line at twitter or you can click on the “Like” button on the top of this post ;)
Resources (Plugins for WordPress):
Thanks to my Readers :)
- Facebook Like plugin including support for Open Graph (XFBML)
- Facebook Like Plugin from Smoking Gunn (Features Live Preview, Thanks Stefan to introduce that).
- Alternatively … Kouguu FB Like WordPress Plugin with Configurable Admin Screen
- Those who doesn’t want to do code hacking, this one is for them :)
- This is how to Implement in Thesis WordPress theme
And.. I’m spent…
Don’t forget to rate the post too!
_