Jump to content

Where in theme should Facebook button javascript be located

Featured Replies

Posted


To create Facebook's follow button they say you should add this Javascript to your page:

<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/sdk.js#xfbml=1&version=v2.3";
  fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));</script>

 

And then put this code where you want the button to appear:

<div class="fb-follow" data-href="https://www.facebook.com/MyFacebookPage" data-colorscheme="light" data-layout="button" data-show-faces="false"></div>

 

What's the best place to put the Javascript in an IPB Theme so it's available on every page?  Is there a specific section in the default Theme for custom Javascript?
 


To create Facebook's follow button they say you should add this Javascript to your page:

<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/sdk.js#xfbml=1&version=v2.3";
  fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));</script>

 

And then put this code where you want the button to appear:

<div class="fb-follow" data-href="https://www.facebook.com/MyFacebookPage" data-colorscheme="light" data-layout="button" data-show-faces="false"></div>

 

What's the best place to put the Javascript in an IPB Theme so it's available on every page?  Is there a specific section in the default Theme for custom Javascript?
 

​.

 

This what you looking for ?

 

 

.

  • Author

It worked.  Thank you!

  • 2 months later...

Hello,

I have put the code in templates/core/global/globalTemplate but it is not working; I can not see the answer of IN10TION.

Some ideas?

Regards,

Rafa.

Archived

This topic is now archived and is closed to further replies.

Recently Browsing 0

  • No registered users viewing this page.