Skip to content

Instantly share code, notes, and snippets.

@alexdeborba
Created January 17, 2017 04:33
Show Gist options
  • Save alexdeborba/cbeb262deec58a0871d652e77fc8945f to your computer and use it in GitHub Desktop.
Save alexdeborba/cbeb262deec58a0871d652e77fc8945f to your computer and use it in GitHub Desktop.
Load Facebook Like Box Asynchronously
<?php
function fb_js() {
if(self::$script_loaded == 1) return;
self::$script_loaded = 1;
echo '
<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.async = true;
js.src = "//connect.facebook.net/en_US/sdk.js#xfbml=1&version=v2.4";
fjs.parentNode.insertBefore(js, fjs);
}
(document, "script", "facebook-jssdk"));</script>
';
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment