How to Embed Facebook Posts

Step 1:

Prepare the link of you the FB post that you want to embed on your page.

Step 2:

Go to Facebook Developer Page for embedding facebook post.

Step 3:

Fill up the URL of post field using the link of the post you want to embed then click Get Code. filling up post to embed generator

Step 4:

Take note of the codes generated by the generator.

Example

Here's the example code that is added to the page that I want the facebook post to embed.
  1. <!DOCTYPE html>
  2. <meta charset="utf-8">
  3. <title>How to Embed Facebook Posts</title>
  4. <link rel="stylesheet" type="text/css" href="bootstrap4/css/bootstrap.min.css">
  5. </head>
  6. <div id="fb-root"></div>
  7. <script>(function(d, s, id) {
  8. var js, fjs = d.getElementsByTagName(s)[0];
  9. if (d.getElementById(id)) return;
  10. js = d.createElement(s); js.id = id;
  11. js.src = 'https://connect.facebook.net/en_US/sdk.js#xfbml=1&version=v2.12';
  12. fjs.parentNode.insertBefore(js, fjs);
  13. }(document, 'script', 'facebook-jssdk'));</script>
  14. <div class="container">
  15. <h1 class="text-center" style="margin-top:30px;">Embed Facebook Posts</h1>
  16. <hr>
  17. <div class="row justify-content-center">
  18. <div class="col-sm-6">
  19. <div class="fb-post" data-href="https://www.facebook.com/justlove1143/posts/1394900597306817" data-width="500" data-show-text="true"><blockquote cite="https://www.facebook.com/justlove1143/posts/1394900597306817" class="fb-xfbml-parse-ignore">Posted by <a href="https://www.facebook.com/justlove1143/">I love you very much</a> on&nbsp;<a href="https://www.facebook.com/justlove1143/posts/1394900597306817">Sunday, April 15, 2018</a></blockquote></div>
  20. </div>
  21. </div>
  22. </div>
  23. </body>
  24. </html>
That ends this tutorial. Happy Coding :)

Add new comment