Join 3,501 readers in helping fund MetaFilter (Hide)


How to install a facebook button on wordpress blog?
April 22, 2012 11:17 PM   Subscribe

How to install a facebook like button in a wordpress blog?

I'm trying to install a facebook like button in a wordpress blog, I got the two-part code from facebook. According to facebook instructions the first part of the code is to be installed inside the body tag. In the blog, the only body tag is in header.php. (There doesn't seem to be a /body anywhere.) The second part of the code can be placed anywhere you want the button to show up (according to facebook instructions). So far it hasn't worked. I suspect I'm not putting the first code in the right place. I also tried various plugins to do the same thing, none of which worked.
posted by Mrs. Buck Turgidson to Computers & Internet (9 answers total) 1 user marked this as a favorite
 
I'm not familiar with this particular script but based on the wording of your post, you're probably messing up the second part.

The first part of the code, put it under the body tag in header.php - or just before the body tag closes in footer.php. Placement probably won't matter. There are multiple php pages that compile into what you see in your browser.

The code that needs to be placed "anywhere you want" needs to be placed inside the loop that displays your posts. (Do you know what that is?)

Anyway, to say something's "not working" is kind of vague in situations like this so maybe you want to post a link. Or you know I'm feeling kind of punchy right now so if you hit me up with a mefimail in the next few I could respond..
posted by phaedon at 11:38 PM on April 22, 2012


Plugins are the solution to 99% of Wordpress problems
posted by 0bvious at 11:43 PM on April 22, 2012


Facebook has detailed instructions for installing the like button. And in every version, HTML5, XFBML, IFRAME, after it generates the code it says: "Place the code for your plugin wherever you want the plugin to appear on your page." So far this hasn't worked -- but I haven't yet tried XFBML yet. I want to install it in sidebar.php if possible. I installed the google +1 there without any problem. Now I'm wondering if the theme I'm using (notepad) is somehow not compatible.
posted by Mrs. Buck Turgidson at 12:48 AM on April 23, 2012


Have you tried the Wordpress Jetpack plugin? It's an official bonus pack with a lot of stuff that works really well, including automatically adding social buttons.
posted by steinsaltz at 12:52 AM on April 23, 2012


Put the first block of code in header.php right after the < body > tag.
posted by DarlingBri at 2:19 AM on April 23, 2012


Yeah, Jetpack is the way to go. It doesn't actually do the Like button iirc. It does a Share on Facebook, but it also has all the usual suspects (twitter, etc.)
posted by idb at 7:00 AM on April 23, 2012


I have a wordpress.com blog, and I followed these instructions from their forum with success:

"Go to your dashboard, then appearance on the left, then click 'widgets'. There should be one called 'Facebook Like Box' or something around that, and you can add your facebook page to it. Do not make a text widget and put the link of your facebook page."

(I think I'm answering the question you're asking, but I'm not positive. My blog is here, in case you want to see what that option ends up looking like.)
posted by jocelmeow at 7:41 AM on April 23, 2012


I use the ShareThis plugin. No fiddling with HTML/PHP/CSS and it works like a champ.
posted by tommasz at 9:37 AM on April 23, 2012


I installed the plugin AddThis which has a widget that you can place in the sidebar. Widgets was what I needed.
posted by Mrs. Buck Turgidson at 9:00 PM on April 23, 2012


« Older How do I create a Postini acco...   |  Help me plan a fun date in SF ... Newer »
This thread is closed to new comments.