Support

Account

Forum Replies Created

  • Hi James,

    That’s great thanks, replaced my original function with the one above and it works perfectly.

    Many thanks for your help.

    James

  • Hi James,

    Thanks for the reply, sorry I’m a little confused where I would add this. Does it need to go in the functions file? At the moment I have the following code:

    function my_theme_add_scripts() {
    	wp_enqueue_script( 'google-map', 'https://maps.googleapis.com/maps/api/js?v=3.exp&sensor=false', array(), '3', true );
    	wp_enqueue_script( 'google-map-init', get_template_directory_uri() . '/js/google-maps.js', array('google-map', 'jquery'), '0.1', true );   
    }
     
    add_action( 'wp_enqueue_scripts', 'my_theme_add_scripts' );

    I’ve tried modifying this to the following but it doesn’t seem to have any effect:

    function my_theme_add_scripts() {
    	wp_enqueue_script( 'google-map', 'https://maps.googleapis.com/maps/api/js?v=3.exp&sensor=false', array(), '3', true );
    	wp_enqueue_script( 'google-map', 'https://maps.googleapis.com/maps/api/js?key=KEYGOESHERE', array(), '3', true );    
    	wp_enqueue_script( 'google-map-init', get_template_directory_uri() . '/js/google-maps.js', array('google-map', 'jquery'), '0.1', true );   
    }
     
    add_action( 'wp_enqueue_scripts', 'my_theme_add_scripts' );

    Thanks,

    James

Viewing 2 posts - 1 through 2 (of 2 total)