Hi guys!
I’d like to know where I’ve to copy the Facebook like button code generate from facebook page.
Is it better to use html5 or xfbml?
Java script SDK goes in header.php?
<div id=”fb-root”></div>
<script>(function(d, s, id) {
var js, fjs = d.getElementsByTagName(s)[0];
if (d.getElementById(id)) return;
js = d.createElement(s); js.id = id;
js.src = “//connect.facebook.net/it_IT/all.js#xfbml=1″;
fjs.parentNode.insertBefore(js, fjs);
}(document, ‘script’, ‘facebook-jssdk’));</script>
Code for page goes in widget or text block?
HTML5
<div class=”fb-like” data-href=”http://www.progettiamocaerano.com/albero-dei-progetti” data-layout=”box_count” data-action=”like” data-show-faces=”false” data-share=”true”></div>
XFBML
Where do I put this code?
<html xmlns:fb=”http://ogp.me/ns/fb#”>
<fb:like href=”http://www.progettiamocaerano.com/albero-dei-progetti” layout=”box_count” action=”like” show_faces=”false” share=”true”></fb:like>
Thank you very much.
Dave
Hi dettospa!
Which theme are you using? You can use HTML5 code and add JavaScript code to bottom of Footer.php file in Appearance > Editor before closing Body tag
Regards,
Yigit
Hi Yigit,
I’m using Enfold theme.
I’ve tried and it works. I noticed, however, when somebody click on share button, link redirects to the correct page but the image is not showing the correct image.
Thanks,
Dave
Hey!
Maybe you need to set the image manually (og:meta tag). You can use Yoast SEO: http://wordpress.org/plugins/wordpress-seo/ to set a facebook preview image for each post/page.
Cheers!
Peter