2776

How to – Add Facebook LIKE button to WordPress Posts


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)); ?>&amp;layout=standard&amp;show_faces=false&amp;width=450&amp;action=like&amp;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(); ?>

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 :)

And.. I’m spent…

Don’t forget to rate the post too!

_

GD Star Rating
loading...
How to - Add Facebook LIKE button to WordPress Posts, 8.8 out of 10 based on 121 ratings

About Ruhani Rabin

Ruhani Rabin is the original owner and author of this blog. He also reviews web 2.0 startups at Tech2all.com. Largely interested in web 2.0 apps & Social Media. Currently the Vice President of MOL Access Portal (MOL is owner of Friendster.com). Also he is Web 2.0 & Social Media Researcher and a Total fun Geek!.. There you have it ;)

Twitter Profile: http://twitter.com/ruhanirabin

  • Hi Robin,yes , it does work well , both like button and comment box are shown, but how can i move it right after the content and before the related post and vote button in my blog. you can see the example post here http://t.co/EyqlPt3, i will appreciate if you could help me out . thank you.
  • Thanks very much for your short tutorial. Been looking all over for something like this. Now I feel stupid after realizing how simple it was. This will make my website that much better.
  • Thank you a lot of. It's help for me :) http://www.Howitwork.info
  • I have the like button a couples of days after they announced it, but How the hell can I implement the open graph in my wordpress?? Thats the question I want an answer for
  • Thanks a lot for this, very useful!
  • thumbs up sir, i have just click the like button at the top! :)
  • Wonderfull post contains great usefull information thanks for it
  • Thank you a ton for the help! I tried a number of plugins, but didn't like that there were very few options of exactly where you could place the button.

    Thanks again for sharing this helpful tip!
  • Thanks so much for the how to. I think my readers will enjoy this feature..

    http://videolinkx.com
  • Steve Patterson
blog comments powered by Disqus

Parse error: syntax error, unexpected '}' in /home/ruhanira/public_html/wp-content/themes/ColdStone/footer.php on line 1