How to Add a Facebook Like Box / Fan Box in WordPress

Do you want to add a Facebook Like Box to your WordPress website?

Adding a Facebook Like Box to your website makes it easy for your audience to like and follow your Facebook page. The more likes you get, the more reputable and trustworthy your brand will look to new users.

In this article, we will show you how to add a Facebook Like Box in WordPress.

How to Add a Facebook Like Box or Fan Box in WordPress

Why Add a Facebook Like Box on Your WordPress Website?

Adding a Facebook Like Box to your WordPress website has some great perks.

First, it helps engage people by letting them easily like your Facebook fan page or business page. This means your posts will show up in their Facebook feed, so you can keep reaching people beyond your website.

Also, the Facebook page Like Box shows how many people have liked your Facebook page. This can work as social proof and encourage more visitors to click ‘Like.’

This tutorial will show you two ways to add a Facebook Like Box: one using a social plugin and the other with code. You can use the quick links below to navigate through our article:

Note: A Facebook Like Box is different from a Like Button. If you want to display that on your website instead, then you can check out our step-by-step guide on how to add a Facebook Like Button in WordPress.

This first method is the easiest and recommended way for beginners to add a Facebook Like Box to their sites. It will also allow you to display your Facebook feed on your website if you wish.

This method uses Smash Balloon, which is a user-friendly WordPress plugin that allows you to embed various social media feeds in WordPress, along with a Like Box.

For this tutorial, you can use the free Smash Balloon Social Post feed plugin. But if you want more features beyond the Like Box (like displaying videos, photos, and events), then we recommend upgrading to the Pro version.

Set Up the Smash Balloon Facebook Feed Plugin

First, you need to install the WordPress plugin in the admin area. After that, go to Facebook Feed » All Feeds and click ‘Add New.’

Creating a new Facebook Feed in the free Smash Balloon plugin

Now, select the ‘Timeline’ feed type.

Then, simply click the ‘Next’ button.

Selecting the Timeline Facebook Feed type in Smash Balloon

At this stage, you will need to connect your Facebook page to your WordPress website.

What you need to do is click the ‘Add New’ button.

Adding a new Facebook Feed source in Smash Balloon

Smash Balloon will direct you to a new screen.

Here, just select ‘Page’ for the source type and then click ‘Connect to Facebook.’

Connecting Smash Balloon with Facebook

Now, you need to log in to your Facebook account.

After that, choose which page(s) for which you want to display the Like Box on your WordPress blog or website. Then, click ‘Next.’

Selecting Facebook Pages to use as sources in Smash Balloon

You will now see the Smash Balloon’s permission settings. We recommend enabling them all to make sure everything works well.

Now, go ahead and click ‘Done.’

The Smash Balloon permission settings when connected to Facebook

The last popup will simply confirm that you’ve successfully linked Smash Balloon with Facebook.

Simply click ‘OK’ to continue.

Confirming that the Smash Balloon and Facebook connection is successful

Smash Balloon will now redirect you to the admin area, where you have to select a Facebook page to use in your timeline feed.

Just pick a page and click ‘Add.’

Choosing a Facebook page to use as a source in Smash Balloon

You will now see the Facebook page you’ve just connected to as a source in the Smash Balloon plugin page.

Simply pick that and click ‘Next.’

Selecting a Facebook page to use as a source for the Smash Balloon Facebook Feed in WordPress

Customize the Facebook Like Box

At this stage, Smash Balloon will bring you to the Facebook feed editor.

The first step is to click ‘Feed Layout’ above the Color Scheme option.

Selecting the Feed Layout menu in the Smash Balloon Facebook Feed editor

Simply scroll down to the ‘Number of Posts’ section.

After that, set the number for both Desktop and Mobile to 0. This will remove the display of all your recent posts and have the feed display the Like Box only.

Alternatively, if you also want to show your Facebook feed along with the Like Box, then you can follow our tutorial on how to create a custom Facebook feed in WordPress.

Removing all display of Facebook post in the Smash Balloon Facebook Feed

Now, go back up.

Then, click ‘Customize’ to go back to the feed editor page.

Clicking the Customize button in Smash Balloon to return to the main Facebook Feed editor

At this stage, you can remove the header of your Facebook feed.

What you need to do is move down to the ‘Sections’ part and select ‘Header.’

Opening the Header section setting in Smash Balloon

This Header setting determines what your Facebook feed’s header will look like.

But in this case, you need to hide it, so just turn off the ‘Enable’ toggle.

Disabling the Facebook Feed header in Smash Balloon

Let’s now go back to the main feed editor page and open the ‘Like Box’ setting. After that, simply turn on the ‘Like Box’ feature.

On this page, you can also adjust the Like Box’s size, position, cover photo display, custom width, custom call-to-action text, and so on.

Enabling the Facebook Like Box feature in Smash Balloon

Once that’s done, just hit the ‘Save’ button in the top right corner.

Embed the Facebook Like Box on Your WordPress Page or Post

At this stage, you can display the Facebook Like Box on a page or a widget-ready area like a sidebar.

To do this, click ‘Embed’ at the top right corner. Now, the Embed Feed popup will appear, giving you two options to display the Like Box.

One is to use a shortcode, and the other is to directly add it to a page or a widget-ready area. The second option is much easier, so we will show you that method first.

The Embed Feed popup for Facebook Feed in Smash Balloon

If you want to add the Like Box to a specific page, click the ‘Add to a Page’ button.

Now, just select a page to add the feature to and click ‘Add.’

Selecting a page to insert the Facebook Feed to in Smash Balloon

You will now arrive at the Gutenberg block editor.

Go ahead and click the ‘+ Add a Block’ button, as instructed by Smash Balloon.

Clicking the Add Block button as instructed by Smash Balloon in the block editor

Once the block inserter library is open, you need to find the Facebook Feed block.

Then, simply drag and drop it wherever it looks best on the page.

Finding Smash Balloon's Facebook Feed block in the block editor

In the block, select the Facebook feed with the Like Box you just created earlier.

The block will then display the Like Box.

Choosing a Smash Balloon Facebook Feed to embed in the block editor

But what if you have multiple Facebook pages and have set up a Like Box for each one using Smash Balloon?

You can also switch between them in the block settings sidebar by picking a feed from the ‘Select a Feed’ dropdown menu.

Switching to a different Facebook Feed in the Smash Balloon block settings sidebar inside the block editor

All you need to do now is click the ‘Update’ button to make the changes official.

Here’s what our Like Box looks like on our demo site:

An example of the Facebook Like Box created with Smash Balloon

If you use a block WordPress theme, then you can also use the Full Site Editor to add the Facebook Like Box block to your theme’s page templates.

For more information about the Full Site Editor, just read our beginner’s guide to Full Site Editing.

Embed the Facebook Like Box Widget in WordPress

If you use a classic WordPress theme, then you may want to display the Facebook Like Box in a widget-ready area, like a sidebar, header, or footer. It’s a great way to show the Like Box without distracting users from the main content on the page.

In the Embed Feed popup, select ‘Add to a Widget’ to go to the block-based widget editor.

Now, like in the previous method, just click the ‘+ Add Block’ button, find the Facebook Feed block, and drag it onto your desired area.

On our demo site, we want to use the Like Box as a WordPress sidebar widget.

Finding the Smash Balloon Facebook Feed widget in the widget editor

In the block, select the Facebook Feed with the Like Box you created earlier.

Then, click ‘Update’ to make the changes live.

Selecting a Smash Balloon Facebook Feed to embed in the widget editor

And you are done!

Here’s what the sidebar on our test site looks like with the Like Box widget:

An example of what the Facebook Like Box widget looks like in the sidebar

Embed the Facebook Like Box Widget With a Shortcode

If the two previous methods don’t work, then we recommend adding the Facebook Like Box or Fan Box using a shortcode.

Simply copy the shortcode from the Embed Feed popup earlier and add it anywhere on your website.

Copying the Facebook Feed embed shortcode in Smash Balloon

For more information on using shortcodes, you can read our guide on how to add shortcodes in WordPress.

Method 2: Adding a Facebook Like Box With Code

If you are only interested in displaying a Like Box without adding any other types of Facebook feeds, then using a Facebook page plugin may seem like overkill. In this case, you can add the Like Box using code instead.

This method may seem intimidating for beginners, but we will show you a foolproof way to insert code using WPCode. It’s a WordPress plugin that makes it easy to add custom code snippets to WordPress without breaking your site.

For this guide, the free WPCode version is enough, although you can upgrade to the Pro version for advanced features like testing mode and a cloud-based code snippets library.

First, let’s install the plugin in WordPress. Once it’s active, go to Code Snippets » + Add Snippet. Then, select ‘Add Your Custom Code (New Snippet)’ and click ‘Use snippet.’

Adding custom code in WPCode

You will now arrive at the code editor. Let’s give your custom code snippet a name first so that you can easily identify it later. For this one, we will name it ‘Facebook JavaScript SDK’ because that’s what we will add here.

Now, keep this tab open and create a new tab on your browser to go to the Facebook Developers page.

In the menu, click ‘Log In’ to sign in to your Facebook account.

Logging into the Facebook Developers page

If this is your first time accessing the page, then complete the onboarding wizard to create a free account.

You will then be directed to the Facebook Developers dashboard. Let’s click on the ‘Create App’ button.

How to create a new Facebook app

On the next page, just select ‘Other’ for the use case.

After that, click on the ‘Next’ button.

Choosing a Facebook use case

Now, you will see all the different apps that you can create for your Facebook page.

To create a Like Box, you can just select ‘Business’ and then click on ‘Next.’

Creating a business application in Facebook

Let’s now give your app a name. It can be anything you like since this is just for reference. You can also enter your email address and select an optional Business Account.

Finally, just click ‘Create app.’

Creating a Facebook application in the Developers console

Let’s now go to the Facebook Developers page for social plugins.

Then, scroll down until you find a section like in the screenshot below:

Here, make sure to fill out your Facebook page URL, empty the ‘Tabs’ field, and specify the width and height of the Like Box if needed.

You can also choose to use a smaller header, disable the cover photo, and more. We’ve also chosen to adapt the Like Box to fit the container width so that the size will adjust responsively to where it’s placed on the website.

Once done, click the ‘Get Code’ button. You will then see a popup that shows you two types of code snippets: JavaScript SDK and iFrame. Both will display your Like Box, but in general, JavaScript SDK is a much better option.

The JavaScript SDK codes to embed the Facebook Like Box

JavaScript SDKs are usually faster because they are directly embedded into the webpage, allowing them to load as part of the main document. iFrames require loading an entire HTML document, which can slow down the page load time.

In the JavaScript SDK tab, make sure the app name you created earlier has been selected.

Then, go ahead and copy the JavaScript SDK API code from Step 2. Now, keep this tab open, but switch to the WPCode tab and paste the code there.

You can leave the Code Type as ‘HTML Snippet.’

Pasting the Facebook JavaScript API to WPCode

Now, scroll down to the ‘Insertion’ section.

The Insert Method can be left as ‘Auto Insert,’ while the Location should be changed to ‘Site Wide Body.’

Finally, just make the code active and click ‘Save Snippet.’

Choosing Auto Insert and Site Wide Body for the code's Insertion settings in WPCode

Next, you will create a second code snippet. You can follow the same steps as before and call it something like ‘Facebook Like Box.’

After that, switch to the Facebook Developers page for social plugins from earlier and copy the code from Step 3.

Navigate to the WPCode tab again and paste the Step 3 code in the Code Preview box. The Code Type can be ‘HTML Snippet.’

Pasting the Facebook Like Box custom code snippet in WPCode

Let’s scroll down to the ‘Insertion’ section.

If you use ‘Auto Insert,’ then you can make the Like Box appear automatically in multiple places that fit the Location category.

In our example, we have decided to choose the ‘Site Wide Footer’ location, which means the Like Box will appear in the footer.

There are other options, too, like Insert Before Post, to display the Like Box before all of your WordPress blog posts.

Selecting the Side Wide Footer location in WPCode

On the other hand, the ‘Shortcode’ method allows you to create a custom shortcode.

You can then add it to specific parts of your website using the shortcode block.

Creating a custom shortcode using WPCode

Once you’ve configured the Insertion settings, just make the code active and click ‘Save Snippet.’

That’s it! You can then visit your website to see what Like Box looks like:

An example of the Facebook Like Box added with WPCode

For more guides on displaying social feeds on your WordPress site, check out our article on adding social media feeds in WordPress.

We hope this article has helped you learn how to add a Facebook Like Box or Fan Box in WordPress. You may also want to check out our ultimate social media cheat sheet and list of the best social media plugins for WordPress.

If you liked this article, then please subscribe to our YouTube Channel for WordPress video tutorials. You can also find us on Twitter and Facebook.

The post How to Add a Facebook Like Box / Fan Box in WordPress first appeared on WPBeginner.

How to Add Facebook Like Button in WordPress

Do you want to add a Facebook Like button in WordPress?

A Facebook Like button on your WordPress website can make it simple and easy for users to like and share your content. You can increase engagement and get more followers.

In this article, we will show you how to add the Facebook Like button in WordPress.

How to add Facebook like button in WordPress

Why Add a Facebook Like Button in WordPress?

Facebook is one of the most popular social media platforms in the world. Many businesses use Facebook to connect with their customers and promote their products.

Adding a Facebook Like button to your WordPress website can help drive more engagement. It also encourages people to share your content on their Facebook profiles and attract new users to your site.

You can use the Facebook Like button to increase your social followers and build a community. It helps raise awareness about your products and services and boosts conversions.

That said, let’s see how you can add a Facebook Like button in WordPress using a plugin or adding custom code.

Method 1: Add Facebook Like Button in WordPress Using a Plugin

In this method, we will be using a WordPress plugin to add Facebook Like button. This method is very easy and recommended for beginners.

The first thing you need to do is install and activate the BestWebSoft’s Like & Share plugin. For more details, see our step-by-step guide on how to install a WordPress plugin.

Upon activation, you can go to Like & Share » Settings from your WordPress admin panel.

Like and share plugin settings

Next, you’ll need to add the Facebook App ID and App Secret. If you don’t have this information, then simply follow the steps below.

How to Create a Facebook App ID and App Secret

Go ahead and click the ‘create a new one’ link under App ID or App Secret field in the Like & Share plugin.

This will take you to the Meta for Developers website. We suggest opening the website in another tab or window because you’ll need to open the Like & Share settings page in your WordPress dashboard to enter the app ID and secret.

From here, you’ll need to select an app type. Go ahead and choose ‘Business’ as the app type and click the ‘Next’ button.

Choose your app type

Next, you’ll need to provide basic information about your app.

You can enter a display name for your app, and be sure that the correct email address appears under the ‘App contact email’ field. Facebook will automatically pick the email address of the account you’re currently logged in as.

There’s also an option setting to choose a business account. You can leave this on ‘No Business Manager account selected’ and click the ‘Create app’ button.

Enter basic information for app

A popup window will now appear where Facebook will ask you to re-enter your password.

This is for security purposes to stop malicious activity on your account. Go ahead and enter your Facebook account password and click the ‘Submit’ button.

Reenter your Facebook password

After that, you’ll see your app dashboard.

From here, you can head to Settings » Basic from the menu on your left.

Go to basic settings page

On the Basic settings page, you will see the ‘App ID’ and ‘App Secret.’

You can now enter this information in the Like & Share plugin settings in your WordPress dashboard.

Copy the app ID and secret

Finish Up Customizing Your Facebook Like Button

First, copy the ‘App ID’ and head back to the tab or window where you have the Like & Share » Settings page opened. Simply enter the ‘App ID’ in the respective fields.

Now repeat the step by copying the ‘App Secret’ data from Meta for Developers page and pasting it into the Like & Share plugin settings.

Customize your Facebook like button

Once you’ve done that, you can choose whether to show the Facebook Like button along with the Profile URL and Share buttons.

There are also settings to edit the Facebook Like button’s size, its position before or after the content, and alignment.

More customization options

If you have enabled the Profile URL button, then you can scroll down to the ‘Profile URL Button’ section and enter your Facebook username or ID.

When you’re done, don’t forget to save your changes.

Now, the plugin will automatically add a Facebook Like button to your WordPress website and position it based on your settings.

You can also use the [fb_button] shortcode to add the Facebook Like button anywhere on your site.

That’s all! You can now visit your site and see the Like button on each post.

Facebook like button preview

Method 2: Manually Add Facebook Like Button in WordPress

Another way to add a Facebook Like button is by using custom code. However, this method requires you to add the code directly in WordPress so we only recommend it for people who are comfortable editing code.

With that in mind, we are going to use the free WPCode plugin to do so, which makes it simple for anyone to add code to their WordPress blog.

First, you need to visit the ‘Like Button’ page on the Meta for Developers website and scroll down to the ‘Like Button Configurator’ section.

Get code from Facebook developer site

Next, you can enter the URL of your Facebook page in the ‘URL to Like’ field. This will be the page you’d like to connect with the Facebook Like button.

After that, simply use the configuration to choose the Like button layout and size. You will also see a preview of the Like button.

Once 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 SDK code

Please note that if you directly add these code snippets to your WordPress theme, it may break your website. Plus, the code snippets will be overwritten when you update the theme.

An easier way of adding code to your is by using the WPCode plugin. It lets you paste code snippets to your website and easily manage custom code without having to edit the theme files.

First, you’ll need to install and activate the WPCode free plugin. For more details, please see our guide on how to install a WordPress plugin.

Upon activation, you can head to Code Snippets » Header and Footer from your WordPress dashboard. Now, you’ll need to copy the first code snippet and add it to your WordPress theme’s header.php file right after the <body> tag.

Simply copy the code and enter it in the ‘Body’ section. Don’t forget to click the ‘Save Changes’ button.

Add first code to header section

Next, you need to copy the second piece of code and paste it into your WordPress site to display the Like button.

To start, you can go to Code Snippets » + Add Snippet from your WordPress admin panel or click the ‘Add New’ button.

Click 'Add New Snippet' in WPCode

On the next screen, WPCode will allow you to select a snippet from the pre-built library or add a new custom code.

Go ahead and choose the ‘Add Your Custom Code (New Snippet)’ option and click the ‘Use snippet’ button.

Add custom code in WPCode

After that, you can give a name for your custom code and enter the second code snippet under the ‘Code Preview’ section.

Make sure to click the ‘Code Type’ dropdown menu and select ‘HTML Snippet’ as the code type.

Enter second code and select code type

Next, you can scroll down to the ‘Insertion’ section and select where you’d like the Facebook Like button to appear. For example, let’s say you want it to appear before the content.

Simply click the ‘Location’ dropdown menu and choose the Insert Before Content option under Page, Post, Custom Post Types.

Select location of like button

Once you’re done, you can click the ‘Save Snippet’ button.

You’ll also have to click the toggle and switch it from Inactive to Active.

Save and activate code snippet WPCode

That’s it, a Facebook Like button will appear on your website after entering the code.

What is Open Graph Metadata & How to Add it to WordPress?

Open Graph is metadata that helps Facebook collect information about a page or post on your WordPress site. This data includes a thumbnail image, post/page title, description, and author.

Facebook is quite smart in pulling up the title and description fields. However, if your post has more than one image, then it may sometimes show an incorrect thumbnail when shared.

If you are already using the All in One SEO (AIOSEO) plugin, then this can be easily fixed by visiting All in One SEO » Social Networks and clicking on the Facebook tab.

Next, click the ‘Upload or Select Image’ button to set a default post Facebook image if your article doesn’t have an open graph image.

Upload default Facebook image

Besides that, you can also configure an open graph image for each individual post or page.

When you’re editing a post, just scroll down to the AIOSEO Settings section in the content editor. Next, switch to the ‘Social’ tab and see a preview of your thumbnail.

Now scroll down to the ‘Image Source’ option, and you can then choose an open graph image for your post.

For example, you can select the featured image, attached image, the first image in the content, or upload a custom image to be used as an open graph thumbnail.

Image source for open graph

For more details and alternate ways to add open graph metadata, see our guide on how to add Facebook Open Graph metadata in WordPress.

We hope this article helped you learn how to add Facebook Like button in WordPress. You may also want to see our list of how to register a domain name and the best social media plugins for WordPress.

If you liked this article, then please subscribe to our YouTube Channel for WordPress video tutorials. You can also find us on Twitter and Facebook.

The post How to Add Facebook Like Button in WordPress first appeared on WPBeginner.