S. M. Sakil Imran
S. M. Sakil Imran

Reputation: 53

How I'll Put fb like plugin into Drupal homepage?

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

Answers (3)

AKS
AKS

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

Viktor Bogutskii
Viktor Bogutskii

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

Vishal Khialani
Vishal Khialani

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

Related Questions