Created
December 20, 2011 15:41
-
-
Save maxchirkov/1501991 to your computer and use it in GitHub Desktop.
re-queue javascript in WP with a different handle
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
/** 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