
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()..
1 2 3 4 5 6 7 | // start of fb like code <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:450px; height:60px"></iframe> // end of fb like code <?php the_content(); ?> |
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 ![]()
Thanks to my Readers ![]()
Those who doesn’t want to do code hacking, this one is for them ![]()
And.. I’m spent…
Don’t forget to rate the post too!
_