Skip to content

Instantly share code, notes, and snippets.

@gorobey
Forked from abecoffman/functions.php
Created August 23, 2022 17:24
Show Gist options
  • Save gorobey/bf8d0052e5d76b1160f206f77aaff155 to your computer and use it in GitHub Desktop.
Save gorobey/bf8d0052e5d76b1160f206f77aaff155 to your computer and use it in GitHub Desktop.
Adds Facebook SDK to Wordpress
<?php
function facebook_sdk_init() {
wp_enqueue_script('jquery');
// instruction to only load if it is not the admin area
if ( !is_admin() ) {
// register and load the facebook sdk
wp_register_script( 'facebook-sdk',
'http://connect.facebook.net/en_US/all.js',
array(), '', TRUE);
wp_enqueue_script( 'facebook-sdk' );
// register and load the facebook initalizer script
wp_register_script('facebook-init',
get_bloginfo('template_directory') . '/js/init.facebook.js',
array('facebook-sdk'), '1.0', TRUE);
wp_enqueue_script('facebook-init');
}
}
add_action('init', 'facebook_sdk_init');
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment