Adding Facebook Page Plugin into the site

Hello,

I would like to include facebook page plugin into my website.
https://developers.facebook.com/docs/plugins/page-plugin

I have generated the codes (javascript SDK to be inserted just after the + the actual button code), but I can’t manage to add the first part. Is there a way to access the raw code of the site and do it manually? Or should I do it through X customiser (if so - then how)?

Thanks a lot for your help!

Hi There,

Thank you for writing in, I assume you’re referring to the Step 2 on the Facebook instruction where it says "Step 2: Include the JavaScript SDK on your page once, ideally right after the opening <body> tag."

To do that you need to setup a Child theme and activate it first. Then add the following code (together with your JavaScript SDK) on your Child theme’s functions.php file:

add_action( 'x_before_site_begin', 'x_print_fb_sdk' );
function x_print_fb_sdk(){
  ?>

  <!-- YOUR JavaScript SDK HERE -->

  <?php
}

And then you can paste the code provided on Facebook instruction’s step 3 to a RAW content element or on a Text Widget

Important thing, make sure the FB page is accessible to public.

Hope it helps,
Cheers!