Magento Add Facebook Like/Share button to CMS page

  • magento facebook share button

1. Add a meta tag in template/page/html/head.phtml.

<meta property="og:site_name" content="yoursite.com"/>

2. Create a Custom  Variable from System/Custom Variables, name it anything you like,  and paste the bellow code in the Custom Variable’s content area.

http://www.rocketcontest.org/faqs.cfm

http://www.rocketcontest.org/multimedia.cfm

<div class="fblike">
<fb:like href="http://www.your-magento-store.com" layout="standard" action="like" font="segoe ui" colorscheme="light" /></fb:like>
</div>
<div class="fbshare">
<a name="fb_share"></a>
<script src="http://static.ak.fbcdn.net/connect.php/js/FB.Share"
type="text/javascript">
</script>
</div>
<div id="fb-root"></div>
<script>
/* <![CDATA[ */
window.fbAsyncInit = function() {
FB.init({appId: 'your app id', status: true, cookie: true,
xfbml: true});
};
(function() {
var e = document.createElement('script'); e.async = true;
e.src = document.location.protocol +
'//connect.facebook.net/en_US/all.js';
document.getElementById('fb-root').appendChild(e);
}());
/* ]]> */
</script>

3. To add like/share button to cms or static block, use the “Insert Variable” button to insert the Custom Variable you have just created.

Comments Closed