How to Add Facebook Like Button in WordPress




First, you need to visit the Like button page on Facebook developers website and scroll down to ‘Like Button Configurator’ section.



Use the configuration to choose the Like button layout and size. You will see a preview of the Like button below.

You can leave the URL field empty, as we will dynamically fill in the URL in WordPress.
Once you are satisfied with the preview, click on the ‘Get Code’ button.

This will bring up a popup showing you two pieces of code snippets under the JavaScript SDK tab.



Copy the first code snippet and add it to your WordPress theme’s header.php file right after the <body> tag.

Next, you need to copy the second piece of code and paste it in your WordPress theme’s template files where you want to actually display the Like button.

Most probably you will want to add it to single.php, archive.php, page.php, etc. However, if your WordPress theme uses content templates, then you will need to add it to content templates.
Please note that if you directly add these code snippets to your WordPress theme, then they will be overwritten when you update the theme.




Related Post


Latest Post


Recent Posts Widget

Make sure to never miss a thing...

Get the latest news from the creative industry along with other creative goodies, conveniently delivered to social media.