Skip to content

Instantly share code, notes, and snippets.

@maxchirkov
Created December 20, 2011 15:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save maxchirkov/1501991 to your computer and use it in GitHub Desktop.
Save maxchirkov/1501991 to your computer and use it in GitHub Desktop.
re-queue javascript in WP with a different handle
/** re-queue Google Maps script in Simple Real Estate Pack
* under different handle to avoid conflicts with other plugins
*/
add_action('wp_print_styles', 'custom_script_requeue');
function custom_script_requeue(){
//check if Simple Real Estate Pack's function that registeres the script exists
if( !function_exists('srp_default_headScripts') )
return;
//dequeue Google Maps script with "google" handle
wp_dequeue_script('google');
$googlepath = "http://maps.google.com/maps/api/js?sensor=true";
//enqueue Google maps script with handle "googlemaps3"
wp_enqueue_script( 'googlemaps3', $googlepath, FALSE, false, false );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment