How to add Facebook Like Box and change language to local

Facebook Like Box allows website owners to provide their visitors with an easy way to join their facebook community and get updates right in their Facebook news feed with a click to like from their website. It is a good way to promote a  Facebook Page. Facebook Like Box only works for Facebook Pages, this isn’t working for Facebook Profiles

Adding Facebook Like manually without a plugin

Login to your Facebook account. Go to Facebook Social Plugin’s Like Box page. Provide the URL of your Facebook page and configure the looks of the like box.

There three methods to add Facebook Like Box after we click Get Code button, HTML5, IFRAME and XFBML.

HTML5

As instruction say there, copy the first part of the code (JavaScriptSDK) and paste it right after <body> tag which is usually found in header.php file, e.g

&amp;lt;/pre&amp;gt;
&amp;lt;div id="fb-root"&amp;gt;&amp;lt;/div&amp;gt;
&amp;lt;pre&amp;gt;&amp;lt;script&amp;gt;// &amp;lt;![CDATA[
(function(d, s, id) {
var js, &amp;lt;span class="hiddenSpellError" pre="" data-mce-bogus="1"&amp;gt;fjs&amp;lt;/span&amp;gt; = d.getElementsByTagName(s)[0];
if (d.getElementById(id)) return;
js = d.createElement(s); js.id = id;
js.src = "//connect.facebook.net/en_US/sdk.js#xfbml=1&amp;amp;appId=370859723023930&amp;amp;version=v2.0";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));
// ]]&amp;gt;&amp;lt;/script&amp;gt;

After that we could copy second part of code underneath first part of code

&amp;lt;div class="fb-like-box" data-href="https://www.facebook.com/PixelInsert" data-colorscheme="light" data-show-faces="true" data-header="true" data-stream="false" data-show-border="true"&amp;gt;&amp;lt;/div&amp;gt;

This part of the code tells JavaScript SDK that we loaded earlier to display the like box at this location with these parameters.

We are using Text Widget to add Facebook Like Box to sidebar of our site.  Go to Appearance » Widgets. Drag and drop a text widget to your sidebar and paste all inside it. Save the text widget

Facebook Like Box

IFRAME

Iframe is the easiest way to add Facebook Like Box. Drag and drop a text widget to your sidebar, copy iframe code from Facebook Social Plugin’s Like Box and  paste iframe code inside it. Save the text widget. That’s it

XFBML

Steps to add XFBML almost same with HTML5 method, except for XML Namespace.

xmlns:fb="http://ogp.me/ns/fb#"&amp;gt;

Add XML Namespace  to the <html> tag of your  header.php, before <body>

After that, copy first code and third code (JavaScript SDK and fb:like-box) from Facebook Social Plugin’s Like Box and  paste the code inside text widget

Change Facebook Like Box language (localization)

HTML5 and XFBML

Find following code in JavaScript SDK

js.src = "//connect.facebook.net/en_US/sdk.js#xfbml=1&amp;amp;appId=370859723023930&amp;amp;version=v2.0";

See en_US in above code, change it to local language

IFRAME

We need to add locale operator to iframe code, e.g

&amp;lt;iframe src="//www.facebook.com/plugins/likebox.php?locale=fr_FR&amp;amp;href=https%3A%2F%2Fwww.facebook.com%2FPixelInsert&amp;amp;width&amp;amp;height=290&amp;amp;colorscheme=light&amp;amp;show_faces=true&amp;amp;header=true&amp;amp;stream=false&amp;amp;show_border=true&amp;amp;appId=203533006486565" scrolling="no" frameborder="0" style="border:none; overflow:hidden; height:290px;" allowTransparency="true"&amp;gt;

See this part of code above

locale=fr_FR

List of Local Languages for Facebook


Comments

Leave a Reply

Your email address will not be published. Required fields are marked *

%d bloggers like this: