How to Add Facebook Like Button in WordPress: Code and Manually


Searching for a way to attract more traffic to your WordPress website? Why don’t you use Facebook Like buttons? With a click, your visitors can like and share your content on their Facebook accounts.

In this article, we will provide you with a comprehensive tutorial on how to Facebook Like button to your WordPress site.

Why Do You Need Facebook Like Button on Your Site?

You can’t deny the power that Facebook holds – it has 2.4 billion monthly active users, and seven million businesses choose to advertise themselves on this platform.

However, you don’t have to use ads to promote your business on Facebook.

Expand your audience reach by using Facebook Like button. Thanks to the platform’s Open Graph, your site’s link will be posted on the visitors’ news feed when the button is clicked. It’s an easy way to get people to share your website.

How to Add Facebook Like Button?

There are two methods you can use to add a Facebook Like button to your website – inserting code to your theme’s template files or utilizing a WordPress plugin.

Manually Adding the Code

Here are the steps to manually insert the button to your site:

  1. Access Facebook for Developers page and click Like Button Configurator.Facebook Like Button Configurator
  2. Fill out the URL to Like field with your site’s link or the URL of your Facebook page.
  3. Adjust the settings – width, layout, and size – to fit your preferences. You’ll see how the button looks like inside the preview window.
  4. Click Get Code, and a popup box will appear.Like Button Code Snippet
  5. Copy the first code snippet from the JavaScript SDK tab.
  6. Open your WordPress dashboard and head over to Appearance -> Theme Editor.
  7. Select the header.php file under the Theme Files, and paste the code below the <body> tag. Click Update File.WordPress Theme Editor
  8. Go back to the JavaScript SDK tab and copy the second code snippet.
  9. Navigate to Theme Editor again, and select one of the theme files where you want to display the button. For instance, you can choose single.php, page.php, and footer.php.
  10. Click Update File and check your website to see the changes.

Using a Plugin

Another way to add Facebook Like button to your site is by using a WordPress plugin.

There are plenty of plugins available, but we recommend using WP Like Button. It is compatible with all the best WordPress themes, provides four different responsive button layouts, and can display a Share button along with the Like button.

Here is how you use the plugin:

  1. Once you have installed and activated the plugin, open your WordPress dashboard and select WP Like Button menu.
  2. Use “Where to display?” setting to choose where you want the button to be displayed.WP Like Button Settings
  3. If you do not want to show the button on particular pages, select the Exclude specific pages and posts. A dropdown menu will appear where you can pick the posts you want to exclude.
  4. Scroll down to the Preview section to customize the looks of your button.
  5. Hit Save Settings — and you’re done!WP Like Button Preview Section

Alternatively, the plugin also allows you to manually add the button by inserting the [fblike] shortcode to your WordPress editor.

If you want to disable the Like button, simply switch the On/Off toggle located at the bottom of the settings page.

Conclusion

All in all, Facebook Like button is an important tool to boost your website traffic. The more readers like and share your content, the bigger the possibility that your website will thrive.

In this tutorial, you’ve learned two methods to add Like buttons to your site. The first one requires you to get a certain code from Facebook for Developers, while the other needs you to use a plugin.

Which method do you prefer? Let’s discuss it in the comment section below!

Jaspreet Singh Ghuman

Jaspreet Singh Ghuman

Jassweb.com/

Passionate Professional Blogger, Freelancer, WordPress Enthusiast, Digital Marketer, Web Developer, Server Operator, Networking Expert. Empowering online presence with diverse skills.

jassweb logo

Jassweb always keeps its services up-to-date with the latest trends in the market, providing its customers all over the world with high-end and easily extensible internet, intranet, and extranet products.

Contact
San Vito Al Tagliamento 33078
Pordenone Italy
Item added to cart.
0 items - 0.00
Open chat
Scan the code
Hello 👋
Can we help you?