How to Integrate Facebook Comments Plugin

Step 1:

Go to Facebook Developer Page for comments plugin.

Step 2:

Follow the step by step tutorial and input necessary field for the Comments Plugin Code Generator.

Step 3:

Fill up the form and click Get Code button. facebook comment plugin generator

Step 4:

Take note of the codes given by the generator and the steps on how to integrate them to your app.

Example

This is the example integration of the codes given by the generator.
  1. <!DOCTYPE html>
  2.         <meta charset="utf-8">
  3.         <title>How to Integrate Facebook Comments Plugin</title>
  4.         <link rel="stylesheet" type="text/css" href="bootstrap4/css/bootstrap.min.css">
  5. </head>
  6. (function(d, s, id) {
  7.         var js, fjs = d.getElementsByTagName(s)[0];
  8.         if (d.getElementById(id)) return;
  9.         js = d.createElement(s); js.id = id;
  10.         js.src = 'https://connect.facebook.net/en_US/sdk.js#xfbml=1&version=v2.12';
  11.         fjs.parentNode.insertBefore(js, fjs);
  12. }(document, 'script', 'facebook-jssdk'));
  13.  
  14. <div class="container">
  15.         <h1 class="text-center" style="margin-top:30px;">How to Integrate Facebook Comments Plugin</h1>
  16.         <hr>
  17.         <div class="row justify-content-center">
  18.                 <div class="col-sm-6">
  19.                         <div class="fb-comments" data-href="http://localhost/facebook_comment/index.html" data-numposts="10"></div>
  20.                 </div>
  21.         </div>
  22. </div>
  23. </body>
  24. </html>
That ends this tutorial. Happy Coding :)

Add new comment