Add a Facebook Like Button to Your Site in 2 Minutes

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

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?

17 thoughts on “Add a Facebook Like Button to Your Site in 2 Minutes”

  1. noaspa says:

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

    1. daclements says:

      And how did it work for you? it looks like your main site is a blogspot site and it probably won\’t work there

  2. noaspa says:

    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

    1. daclements says:

      So it does, that\’s interesting. I guess blogspot uses the same tags as WordPress. Thanks for folioing up!

  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

    1. daclements says:

      Ahhh, I've not got round to using hooks yet. That's one of the next things on my learning list I suppose ;)

  4. Ileane says:

    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

    1. daclements says:

      Hi Ileane – nice to meet you. I've seen your name floating around quite a bit, so it's good to see you here. I personally use IShowU HD for recording my screencasts. I wasn't sure about screencast-o-matic and had never heard of Screenr, but IShowU is a nice piece of software.

      Take care
      My recent post Add a Facebook Like Button to Your Site in 2 Minutes

  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-

    1. daclements says:

      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. Alexandra says:

    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.

    1. Dave says:

      Yes, I actually covered this in a recent post: Facebook & Twitter Buttons Without Plugins. Hope this helps!

      1. Alexandra says:

        Thanks! I did it, but with plugins though. :)

        1. Dave says:

          Well, glad you got figured out at any rate. What plugin did you use out of interest?

          1. Alexandra says:

            “ShareThis” plugin. But I’m having some issues with updates in number of tweets and “likes” I had before installation of this plugin.

  7. mlwebdesign says:

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

    1. Were you able to get is installed without too much trouble?

Leave a Reply