Reputation: 53
I want to add a facebook like social plugin into my Drupal website. But I'am unable to find the file in which I'll write the plugin code. Please help me.
Upvotes: 0
Views: 3832
Reputation: 4658
FB like button and like box are different. Like button is to "like" a single page and it comes with an optional inline counter. But Like box is to show who other likes a particular Facebook page. It's appearing as a box. You can grab the like box code from your facebook page admin UI and put it in a custom block. http://drupal.org/project/fb_social is a good module that gives a lot of facebook elements.
Facebook like button code - https://developers.facebook.com/docs/reference/plugins/like/
Facebook like box code - https://developers.facebook.com/docs/reference/plugins/like-box/
Add a fb like button - http://drupal.org/project/fblikebutton (or edit node.tpl.php), http://drupal.org/project/sociallinks
Add fb like box - Custom block, http://drupal.org/project/fb_social or page.tpl.php (I recommend to not do this unless this you have a very good understanding in theming. Less configurable)
Like box should be a module. Like button is a node-element.
Upvotes: 0
Reputation: 930
In page.tpl.php between insert this analog with your appcode from facebook
<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_EN/all.js#xfbml=1&appId=YOUR_APP_NUMBER";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));</script>
And in place for Like button insert/ For example inser this in block with PHP filter
<div class="fb-like" data-href="http://yoursite.com/<? echo $_SERVER["REQUEST_URI"]; ?>" data-send="false" data-width="450" data-show-faces="false" data-colorscheme="dark"></div>
Upvotes: 1
Reputation: 2587
You don't need to add any code there is already a module for this http://drupal.org/project/fblikebutton
Simply install the module in your drupal instance.
Cheers, Vishal
Upvotes: 1