Title: Facebook like button
Last modified: August 30, 2016

---

# Facebook like button

 *  Resolved [TeqToo](https://wordpress.org/support/users/teqtoo/)
 * (@teqtoo)
 * [10 years, 9 months ago](https://wordpress.org/support/topic/facebook-like-button-41/)
 * I’m trying to add a simple Facebook “Like” button in one of the sidebars using
   a text widget. Following the instructions on this page: [https://developers.facebook.com/docs/plugins/like-button#faqlayout](https://developers.facebook.com/docs/plugins/like-button#faqlayout)
 * I’ve added it to the left sidebar, which only appears on the home page – [http://nysbs.org/newsite/](http://nysbs.org/newsite/)
   It’s all the way down at the bottom. If you click the like button, it opens a
   box, which is cut off about halfway, vertically. What am I doing wrong?

Viewing 7 replies - 1 through 7 (of 7 total)

 *  Theme Author [Shaped Pixels](https://wordpress.org/support/users/shaped-pixels/)
 * (@shaped-pixels)
 * [10 years, 9 months ago](https://wordpress.org/support/topic/facebook-like-button-41/#post-6661484)
 * Are you wanting to move your like button upward? If so, you can drag your widgets
   in the left sidebar admin and reposition them. As for the popup, when I click
   on the like button, the window is always in the middle of my browser window. 
   If this window is being cutoff, you may want to contact their support. You also
   have the option to find a facebook plugin (widget) that should also give you 
   another option.
 *  Thread Starter [TeqToo](https://wordpress.org/support/users/teqtoo/)
 * (@teqtoo)
 * [10 years, 9 months ago](https://wordpress.org/support/topic/facebook-like-button-41/#post-6661485)
 * No, I know how to move the button up further. I put it at the bottom because 
   it’s so ugly, I don’t want the client to see it. [:-) It’s doing the same thing
   no matter where I put it, though.
 * Here’s a link to a screenshot of the left sidebar.
 * [http://nysbs.org/newsite/wp-content/uploads/2015/10/screenshot.jpg](http://nysbs.org/newsite/wp-content/uploads/2015/10/screenshot.jpg)
 * All of the plugins I found wanted me to create an “app” on Facebook to link up
   the WordPress site with their Facebook feed. I don’t need that…all I want to 
   do is give people the option to Like the client’s website on their own Facebook
   feeds.
 *  Theme Author [Shaped Pixels](https://wordpress.org/support/users/shaped-pixels/)
 * (@shaped-pixels)
 * [10 years, 9 months ago](https://wordpress.org/support/topic/facebook-like-button-41/#post-6661488)
 * Thanks for the screenshot. Not sure why the popup is opening there because I 
   believe it’s coded to open in the middle of the window. Where can I find the 
   facebook code you used so I can try this on my test site?
 *  Thread Starter [TeqToo](https://wordpress.org/support/users/teqtoo/)
 * (@teqtoo)
 * [10 years, 9 months ago](https://wordpress.org/support/topic/facebook-like-button-41/#post-6661562)
 * I generated the code here: [https://developers.facebook.com/docs/plugins/like-button](https://developers.facebook.com/docs/plugins/like-button)–
   Used the “Like button configurator”. Put in the url of the site, chose the options
   I wanted, then clicked “Get code”. It generates two pieces of code – the first
   one it says “Include the JavaScript SDK on your page once, ideally right after
   the opening <body> tag.”
 *     ```
       <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.5";
         fjs.parentNode.insertBefore(js, fjs);
       }(document, 'script', 'facebook-jssdk'));</script>
       ```
   
 * The second piece it says: “2. Place the code for your plugin wherever you want
   the plugin to appear on your page.”
 * `<div class="fb-like" data-href="http://www.nysbs.org" data-width="400" data-
   layout="standard" data-action="like" data-show-faces="false" data-share="true"
   ></div>`
 * I put both pieces of code into the text widget, and then placed the widget in
   various places – right sidebar, left sidebar, footer. I wouldn’t really call 
   what happens when you hit “Like” a ‘pop-up’ – more like a ‘fly-out’, as it opens
   right beside the like button. Hitting the “share” button generated an actual 
   pop-up in the middle of the screen. Didn’t like the way it behaved in any of 
   the places I put it. (In the footer, it was _really_ weird – generated the narrow
   box AND it was half-hidden behind the Search box which I have placed there.)
 * The Configurator asks you to specify the width of the plug-in, but tells you 
   the minimum width and the default width of the various layouts. I originally 
   thought a layout that’s too wide would play havoc with the narrow sidebars if
   that was the width of the actual buttons, so I chose one of the narrower layouts.
   That didn’t resolve anything, so I played around with it some more and went back
   to the Standard layout, which it says the default width is 400 pixels. But if
   I left the width field blank it resulted in that very narrow fly-out box I posted
   the screen shot of, with some of the content cut off. If I actually entered ‘
   400’ in the width box, the fly-out was wider, but still not wide enough to show
   the whole box. So I tried altering the code and replacing the 400 with 600. That
   seems to make the fly-out box the correct width.
 * The whole thing is very strange.
 *  Thread Starter [TeqToo](https://wordpress.org/support/users/teqtoo/)
 * (@teqtoo)
 * [10 years, 9 months ago](https://wordpress.org/support/topic/facebook-like-button-41/#post-6661563)
 * I also tried some of the other layouts (box-count, button-count, button). Only
   layout increasing the width of the plugin seems to work with is the standard 
   layout. All the others generate that narrow fly-out, no matter what number I 
   put in the width box in the generator.
 *  Theme Author [Shaped Pixels](https://wordpress.org/support/users/shaped-pixels/)
 * (@shaped-pixels)
 * [10 years, 9 months ago](https://wordpress.org/support/topic/facebook-like-button-41/#post-6661600)
 * Install the “Enhanced Text Widget” and then add the script and the html code 
   together in the widget. So with the facebook example code:
 *     ```
       <!-- Load Facebook SDK for JavaScript -->
           <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";
             fjs.parentNode.insertBefore(js, fjs);
           }(document, 'script', 'facebook-jssdk'));</script>
   
           <!-- Your like button code -->
           <div class="fb-like"
               data-href="http://www.your-domain.com/your-page.html"
               data-layout="standard"
               data-action="like"
               data-show-faces="true">
           </div>
       ```
   
 * Then publish the widget to where you want it.
 * Regarding the code above, both the script and the button html needs to be together.
   Plus, if you were just using the default WP text widget, it won’t work properly
   which is why the Enhanced Text Widget is better suited.
 * One thing that puzzles me is the number of facebook like plugins/widgets that
   are not compatible with WP 4.3, but also, so many of them require your facebook
   page ID or URL.
 *  Thread Starter [TeqToo](https://wordpress.org/support/users/teqtoo/)
 * (@teqtoo)
 * [10 years, 9 months ago](https://wordpress.org/support/topic/facebook-like-button-41/#post-6661616)
 * Oh awesome! That worked great! Thank you! I’d never heard of the enhanced text
   widget before. Learn something new every day.

Viewing 7 replies - 1 through 7 (of 7 total)

The topic ‘Facebook like button’ is closed to new replies.

 * ![](https://i0.wp.com/themes.svn.wordpress.org/longevity/1.5.2/screenshot.png)
 * Longevity
 * [Support Threads](https://wordpress.org/support/theme/longevity/)
 * [Active Topics](https://wordpress.org/support/theme/longevity/active/)
 * [Unresolved Topics](https://wordpress.org/support/theme/longevity/unresolved/)
 * [Reviews](https://wordpress.org/support/theme/longevity/reviews/)

 * 7 replies
 * 2 participants
 * Last reply from: [TeqToo](https://wordpress.org/support/users/teqtoo/)
 * Last activity: [10 years, 9 months ago](https://wordpress.org/support/topic/facebook-like-button-41/#post-6661616)
 * Status: resolved