The code below works on one page, but not another page (the place it should be – the same place as on the other page) – is blank.
This code displays the facebook like button, and is copied verbatim from the facebook website.
The code is there – I checked “view page source” in Firefox, it just isn’t doing anything.
I can put another script, the “find us on facebook” button, either directly above or below this code, and that shows up okay.
<script src="http://connect.facebook.net/en_US/all.js#xfbml=1"></script><fb:like
href="http://www.facebook.com/pages/[our name]/[our number]" layout="box_count"
show_faces="false" width="50"></fb:like>
UPDATE
If I use the iframe code instead of the XFBML code from: http://developers.facebook.com/docs/reference/plugins/like/ then it works on both pages (but I can’t format that right – WordPress doesn’t like iframes in widgets).
What is going on?
UPDATE
When I disable the WordPress Facebook Share plugin this problem goes away. There may be a problem with double initialization of the Facebook SDK, as pointed out by Chris Livey below. Is there some html I can add before the “like” code to de-initialize the SDK?
You mentioned Firefox. You should start with looking in the Tools | Error Console to see if any javascript errors occurred during the page load.
The next step is to get the firebug addon and use it to see what might be happening.
(removed update – info did not apply)
UPDATE:
Okay, the word press plug in clobbering you. If you are going to keep the word press plug in then remove this:
From your button code and everything should work just fine.
UPDATE 2:
From all of the comments, this issue boiled down to a word press plugin using it’s own javascript definition for the FB object. Fortunately before creating that object it performs a test to see if FB is already defined.
The fix then is to add the correct FB script to the top of the page such that it is executed by the browser BEFORE the word press FB Share button plugin script. Because it is executed first, the word press plugin can’t screw it up while continuing to function correctly.
This only works if the browser executes the scripts in the order seen on the page.
The real fix would be for the word press plugin to be modified to use the full FB object from connect.facebook.com instead of the smaller one it provides.