Load google maps scripts only when required
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
<?php
|
||||
function sportspress_admin_enqueue_scripts() {
|
||||
function sportspress_admin_enqueue_scripts( $hook ) {
|
||||
// Add ThemeBoy icon font, used in the admin stylesheet.
|
||||
wp_enqueue_style( 'themeboy', SPORTSPRESS_PLUGIN_URL . 'assets/css/themeboy.css', array(), null );
|
||||
|
||||
@@ -7,8 +7,12 @@ function sportspress_admin_enqueue_scripts() {
|
||||
wp_enqueue_style( 'sportspress-admin', SPORTSPRESS_PLUGIN_URL . 'assets/css/admin.css', array(), time() );
|
||||
|
||||
wp_enqueue_script( 'jquery' );
|
||||
wp_enqueue_script( 'google-maps', 'http://maps.googleapis.com/maps/api/js?sensor=false&libraries=places' );
|
||||
wp_enqueue_script( 'jquery-locationpicker', SPORTSPRESS_PLUGIN_URL .'/assets/js/locationpicker.jquery.js', array( 'jquery' ), '0.1.6', true );
|
||||
|
||||
if ( $hook == 'edit-tags.php' && isset( $_GET['taxonomy'] ) && $_GET['taxonomy'] == 'sp_venue' ):
|
||||
wp_enqueue_script( 'google-maps', 'http://maps.googleapis.com/maps/api/js?sensor=false&libraries=places' );
|
||||
wp_enqueue_script( 'jquery-locationpicker', SPORTSPRESS_PLUGIN_URL .'/assets/js/locationpicker.jquery.js', array( 'jquery' ), '0.1.6', true );
|
||||
endif;
|
||||
|
||||
wp_enqueue_script( 'sportspress-admin', SPORTSPRESS_PLUGIN_URL .'/assets/js/admin.js', array( 'jquery' ), time(), true );
|
||||
|
||||
// Localize scripts.
|
||||
|
||||
Reference in New Issue
Block a user