How to add Facebook comments for dynamic websites | 2my4edge

27 June 2016

How to add Facebook comments for dynamic websites

Facebook provides more features, like that, add facebook comments for dynamic php websites. here are going to add facebook comments system to our website or web page. this is the one of the simple way to add facebook comment system to our website. Let see the code and steps to make facebook comments plugin. 



STEP 1 :

Click on this link https://developers.facebook.com/docs/plugins/comments to make facebook comment system.


STEP 2 :
ADD this code in you website.
<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.6
&appId={YOUR_APP_ID}";
  fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));</script>


STEP 3 :
This is to where you want to display the facebook comment system in you website.
<?php $uri = $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI']; ?>
<div class="fb-comments" data-href="<?php echo $uri; ?>" data-numposts="5">
</div>



3 comments:

  1. Thanks for this post

    ReplyDelete
  2. People can interact with your business as they would with any of their other social networking site friends - they can leave comments and generally enhance the experience of a visit to your page.visit this site

    ReplyDelete

^