-
-
Save gorobey/bf8d0052e5d76b1160f206f77aaff155 to your computer and use it in GitHub Desktop.
Adds Facebook SDK to Wordpress
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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