Add Facebook Like Button To Your WordPress Site Without a Plugin

No need for a plugin to put the Facebook Like button on your posts. Paste this where you want the button in your single.php or post.php depending on the theme you’re using:

<iframe src="http://www.facebook.com/plugins/like.php?
href=<?php echo urlencode(get_permalink()); ?>&amp;layout=button_count
&amp;show_faces=false&amp;width=450&amp;action=like&amp;
font=lucida+grande&amp;colorscheme=light&amp;height=21"
scrolling="no" frameborder="0" style="border:none; overflow:hidden;
width:450px; height:21px;" allowTransparency="true"></iframe>

There are several settings, so if you want yours to look different than mine, generate the code here.
Then, put in

<?php echo urlencode(get_permalink()); ?>

where the URL is in the code, as I’ve done above.
(I’ve had to include carriage returns in the code above to get it to fit in the space. You might need to take them out when you paste in the code.)

17 Responses to “Add Facebook Like Button To Your WordPress Site Without a Plugin”

  1. Nice hack! Like it, thanks ~

  2. Im so glad that you shared this! I had much trouble with implementing this feature cause the 2 plugins i was using were not compatible. Now i dont have to use another plug in. Thanks!

  3. Vreme says:

    Nice – this is just a thing I really needed and couldn’t find till now.

  4. Cathie says:

    Thanks. I just found you and your sites and reading up a storm. I can’t get enough. I’m going to put this Facebook icon on my blog or try to. I hope to spruce up my blog now that I’ve found you.

  5. Eddie Gear says:

    I was having a hard time with the Facebook Like plugin. However I fixed it later. This seems pretty neat. Thanks.

  6. Bridging says:

    Thanks for this – i have been having hassles with compatibility with my facebook plugin – i will try this and let you know how it goes

    Thanks

    Gary

  7. Drizzy says:

    Awesome. Been looking for something like this for a minute.

  8. Sunny says:

    Thanks! This is so helpful!

  9. O man! Thanks for this, I have been looking for this to put it on my site, I have a facebook link, to my page, but not a like button. I will be using this, thanks a lot for the tutorial and keep up the good work on the hacks.

  10. Richard says:

    Hey Great post. I’ve been having so many problems implementing the FB Like button onto http://www.odaso.com (Sorry for linking). I will be try out this code and see if it works for me. fingers crossed!

  11. Jon Lake says:

    Nice info thanks. Sometimes its useful to put a Like button somewhere other than where the plug ins want to put them!

    thanks

  12. Thanks for posting that. I am really interested in improving my wordpress site.

  13. Randy Cox says:

    Finally someone who really know their stuff about Word Press. Thanks for the code

  14. seo plugin says:

    Can I use multiple Search engine optimization plugins for my website. I’ve all-in-one seo and google xml sitemap. But seeking to download more for the additional help. Will this have a detrimental impact on my rankings or will it help tremendously? Thanks very a lot

  15. Binil says:

    First of all, I am not a very avid wordpress user. I use flatpress as my blog script. No hatred for WP, its a good script.

    The good thing about this nice little hack it that I believe that it can be modified for flatpress.

    Thank you..

  16. BlackListed says:

    Nice ! Easy ! go ! thanks. Really helpful. already put that code on my site.

  17. Eempresorium says:

    Thanks for the post. I am paranoid about adding plugins to my site and something like this would work best for me.

Leave a Reply