Advertisement
shakil97bd

How to add facebook comment in your website easily

Oct 19th, 2014
563
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 1.74 KB | None | 0 0
  1. ********************How to add facebook comment in your website easily and make it responsive************************
  2.  
  3. ------------------------------------From Facebook------------------------
  4.  
  5.  
  6. Include the JavaScript SDK on your page once, ideally right after the opening <body> tag.
  7. ---------------------------------------------------------------------------------------------
  8.  
  9. <div id="fb-root"></div>
  10. <script>(function(d, s, id) {
  11.   var js, fjs = d.getElementsByTagName(s)[0];
  12.   if (d.getElementById(id)) return;
  13.   js = d.createElement(s); js.id = id;
  14.   js.src = "//connect.facebook.net/en_US/sdk.js#xfbml=1&version=v2.0";
  15.   fjs.parentNode.insertBefore(js, fjs);
  16. }(document, 'script', 'facebook-jssdk'));</script>
  17.  
  18.  
  19.  
  20. Place the code for your plugin wherever you want the plugin to appear on your page.
  21. --------------------------------------------------------------------------------------------
  22.  
  23. <div class="fb-comments" data-href="http://www.yoursiteurl.com/" data-numposts="5" data-colorscheme="light"></div>
  24.  
  25.  
  26.  
  27. Note: Normally facebook comment box is not responsive.If you want to make it responsive in all devices copy below css code and past this in your stylesheet.
  28.  
  29.  
  30.  
  31. .fb_iframe_widget,
  32. .fb_iframe_widget span,
  33. .fb_iframe_widget span iframe[style] {
  34.   min-width: 100% !important;
  35.   width: 100% !important;
  36. }
  37.  
  38. Note:If you want to see your commented post link with your fb post in your timeline just place the following code wherever you want the plugin to appear on your page....
  39.  
  40. <div class="fb-comments" data-href="<?php the_permalink(); ?>" data-numposts="5" data-colorscheme="light"></div>
  41.  
  42.  
  43.  
  44. ********************************************************** Thank You **************************************************************
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement