Support

Account

Home Forums Front-end Issues Google Maps Field Frontend Issue Reply To: Google Maps Field Frontend Issue

  • 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