Skip to content

Instantly share code, notes, and snippets.

@billcreswell
Last active December 17, 2015 08:38
Show Gist options
  • Save billcreswell/5581045 to your computer and use it in GitHub Desktop.
Save billcreswell/5581045 to your computer and use it in GitHub Desktop.
Add FB Like Button to Each Blogger Post
Put the FB Javascript code in the template
This code was retrieved from https://developers.facebook.com/docs/reference/plugins/like/
at the time of this writing.
# Add to the Template:
1 Template/Edit HTML
2 Underneath the <body> tag:
<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/en_US/all.js#xfbml=1";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));</script>
# Add the tag to all new posts:
1 Posts and Comments/Post Template
2 Add the code:
<div class="fb-like" data-send="false" data-width="450" data-show-faces="true"></div>
From now on, your posts will include the like tag.
# To add to older existing posts,
1 Edit each post, click "html"
2 add this code to the bottom of the post.
<div class="fb-like" data-send="false" data-width="450" data-show-faces="true"></div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment