Adding the Facebook Like Button anywhere on your WordPress site is incredibly easy

Add a Facebook Like Button to Your Site in 2 Minutes


Facebook, as the king of all social media sites with over half a billion users should be one of your primary focuses for your social media strategy, particularly if your site is of ‘general interest’.

Recently, Facebook enabled anyone to add a little bit of code to their site to enable the “Like” feature on their site, which allows friends to quickly tell everyone about your site and also for users to see if any of their friends like the page their on. It’s a very social way of spreading word around about your site.

Adding the code

First, you need to decide where to put the button – it might be before your content, after it, or perhaps in the header or footer. If you want it before or after your content, you’ll need to place the code in single.php and if you want it in your header or footer, you’ll need to put it in header.php or footer.php respectively.

Once you’ve opened up the file for editing, just insert the following code where you want the button to appear:

Now you also have a few configuration options that you should be aware of. Change the following values to customise your button:


This will just show the button and the counter, as opposed to adding text next to the button showing who else you know likes it


Will add the friends icon underneath the button.


Change the wording from Like to Recommend


This might better suit your color scheme.

Did you give it a go? Did you come across any problems?

Categories: Code & Snippets, Social Media | Permalink

What next?

Hire me

If you couldn't quite manage this yourself, find it too intimidating, or just don't have the time to do it, you can always hire Dave to do it. Please get in touch so that we can discuss your needs.

Leave a comment

If you have a question, update, or comment about the tutorial, please leave a comment. I try and respond to every comment, though it may take a few days, so please check back soon.

Let a WordPress Expert help you

Do you want to try this, but feel like you need a helping hand, in case something goes wrong? My service, The WP Butler, gives you access to WordPress expertise whenever you need it. Better yet, I'll keep your site backed up, updated and secure, so that you don't have to worry about it. It's all part of the service. Use coupon DIWW and save 15% on all plans.

Visit The WP Butler


Dave has been tinkering with WordPress for many years, and he now shares his WordPress knowledge here on Do It WIth WordPress to help others realise its impressive power. He can also be hired to help with your WordPress needs. Dave, who is British, is married to his best friend, Marti, with whom he has a beautiful daughter, Ellie. When he's not dabbling with WordPress, he's probably eating Triscuits or hummus, watching an indie film or British TV show, spending time with friends or family, or exploring the world.


  1. Thanks Dave – just did it
    Best wishes
    ( another wanderer – now in Hamburg)
    My recent post Noaspa News – 01092010

  2. Hi Dave,

    I put it in the sidebar & it seems fine
    ( it worked when I "liked" the site).
    Maybe you could test it too? ;—-)

    My recent post Noaspa News – 01092010

  3. I am using Thesis and Its more easier for me to add this code with a hook. Thanks for sharing.
    My recent post Thesis 18- Features and Review of Thesis 18 WordPress Theme

  4. Hey Dave, nice screencast. What are you using to create them? I use Screenr and Screencast-o-matic. Thanks for the tip and the code.
    My recent post How-to Customize Your Amplify Page

  5. I have read last week an article about the scam using the like button on facebook wherein it has been stated that before you put some features to your facebook account, you need to make sure if it is scam or not because there are people that are using this just to have also an easy access to your account which only means that your account is not already secure. it can easily access by those scammers. Who do you think should i prefer to believe?
    My recent post ROR Sitemap for http-wwwcaliforniaduihelpcom-

    • Well clearly you have to exercise caution when allowing apps access to your profile. However, aside from ShareThis being very reputable, they also do not need to connect to your Facebook account, so there are no security risks

  6. Please, can you help with installing both facebook and twitter button just the way you have it on the top of your pages. Question is how to make it like that.

  7. Thats cool..i was looking for facebook plugins for my website…Thanx for share Dave…

Leave a Reply