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 &lt;iframe width=&quot;320&quot; height=&quot;240&quot; style=&quot;border: none; overflow: hidden; width: 450px; height: 60px;&quot; src=&quot;http://www.facebook.com/plugins/like.php?href=&lt;?php echo urlencode(get_permalink($post-&gt;ID)); ?&gt;&amp;layout=standard&amp;show_faces=false&amp;width=450&amp;action=like&amp;colorscheme=light&quot; frameborder=&quot;0&quot; scrolling=&quot;no&quot;&gt;&lt;/iframe&gt; // end of fb like code
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 … 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!