Skip to content

Instantly share code, notes, and snippets.

@abecoffman
Created March 13, 2011 23:21
Show Gist options
  • Save abecoffman/868544 to your computer and use it in GitHub Desktop.
Save abecoffman/868544 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