Skip to content

Instantly share code, notes, and snippets.

@rossharper
Created March 20, 2012 00:03
Show Gist options
  • Save rossharper/2128718 to your computer and use it in GitHub Desktop.
Save rossharper/2128718 to your computer and use it in GitHub Desktop.
Registering sharing scripts with Wordpress (inc Pinterest)
<?php
function register_sharing_scripts()
{
if( is_single() || is_home() )
{
wp_enqueue_script('twitter-share', 'http://platform.twitter.com/widgets.js', null, null, true);
wp_enqueue_script('facebook-share', 'http://static.ak.fbcdn.net/connect.php/js/FB.Share', null, null, true);
wp_enqueue_script('google-plusone', 'https://apis.google.com/js/plusone.js', array(), null, true);
wp_enqueue_script('pinterest', 'http://assets.pinterest.com/js/pinit.js', array(), null, true);
}
}
add_action( 'wp_enqueue_scripts', 'register_sharing_scripts' );
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment