Facebook Javascript troubles in RW, Stacks, Foundation

The last post I could find on this was 2015, so I think it must be out of date and unfortunately it didn’t help me figure it out. I could really use help :slight_smile:

I am trying to add the script generated from Facebook development site (https://developers.facebook.com/docs/plugins/like-button) to help you create a like button.

It tells you for the Javascript SDK generated to paste the first part in the tags - so I am placing it in: HTML Code, Body tab of the page inspector (of the page where I want the like button to appear).

Then the second part of the script I am placing inside of an HTML stack, inside a 2 column Foundation stack (foundation theme).

Nothing appears in preview or when I publish. Any ideas what I am doing wrong?

Try highlighting the code, then clicking Format - Ignore Formatting. That might do it…

Did you remove the
<script>
and
</script>
?

RW puts them in for you and paste as plain text or remove formatting.

2 Likes

Thank you for the suggestion. I had not removed it but what I am doing now isn’t yet working. This is what it looks like now in the Body tab of the HTML code inspector:

(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.8"; fjs.parentNode.insertBefore(js, fjs); }(document, 'script', 'facebook-jssdk'));

I am pretty sure that has no formatting.

and this is what is in the HTML stack:
<div class="fb-like" data-href="http://www.facebook/vifabella" data-layout="standard" data-action="like" data-size="small" data-show-faces="true" data-share="true"></div>

Thank you…I appreciate your help!

I just tried adding a button to a site and it worked just fine.

I pasted the initial code into the Body tab:

<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.8";
  fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));</script>

and this code:

<div class="fb-like" data-href="https://www.facebook.com/indianmusiclosangeles" data-width="50" data-layout="button_count" data-action="like" data-size="large" data-show-faces="false" data-share="true"></div>

into an HTML stack.

I did use ‘Paste as plain text’ in both instances. If you haven’t tried using ‘paste as plain text’ you should definitely try that.

Also kind of a long shot, but you may want to try taking it out of the 2 Column stack and see if that makes a difference.

[Edit]
It may just be that your missing this 1st line in the code for the Body tab:
<div id="fb-root"></div>

Also your address here is odd in as much as it’s not https and also does not have the .com suffix:

data-href=“http://www.facebook/vifabella

should be:

I don’t know how that can happen using their generator, but try changing that line to:

data-href=“https://www.facebook.com/vifabella

Thank you, it was very generous of you to spend so much time detailing the steps.

So it works when I use your facebook code! But not with mine --even with the corrected the address issue (that was a mistake when I went back to get the script for the help post…sorry, sloppy).

I feel like a moron, but a very relieved one! Now I know it’s something to do with the facebook page itself and will go fix that!

A very big thank you. I was about to hang up my code boots! :wink:

1 Like

Hi Mila,

In case your still having problems with the FB like button, i came across this stack which maybe helpful:

My button has been working but earlier today I noticed that the 'Like" count had gone back down to 0, so was looking around for possible causes and solutions. I didn’t find either, so am hoping it’s something temporary on FB’s end.

At any rate found this nice donationware stack which I thought I’d pass along…

Thank you - great suggestion! This part is solved for me…now onto the other hurdles!!
Cheers

Just a note to say that as of today my ‘Likes’ counter is back to normal and displaying the correct number of "likes’, and as I didn’t change anything on the site I guess it was something on FB’s end.