function tweakjp_add_sharing_js() {
wp_enqueue_script( 'sharing-js', WP_SHARING_PLUGIN_URL . 'sharing.js', array( ), 4 );
$sharing_js_options = array(
'lang' => get_base_recaptcha_lang_code(),
'counts' => apply_filters( 'jetpack_sharing_counts', true )
);
wp_localize_script( 'sharing-js', 'sharing_js_options', $sharing_js_options );
}
add_action( 'wp_enqueue_scripts', 'tweakjp_add_sharing_js' );
function tweakjp_add_sharing_css() {
wp_enqueue_style( 'sharing', WP_SHARING_PLUGIN_URL. 'sharing.css', false, JETPACK__VERSION );
}
add_action( 'wp_enqueue_scripts', 'tweakjp_add_sharing_css' );
Once you’ve checked the option, you will be able to manually enqueue your own sharing js and css files.
You’ll note that Jetpack uses the WP_SHARING_PLUGIN_URL constant to build the path to load the libraries. You will have to change that constant by your own when re-enqueueing the sharing libraries.
You’ll also notice that you must localize the script and pass over lang and counts values to the sharing.js script. A working example is included above.
Reference
This entry was posted in Developers. Bookmark the permalink.