Support

Account

Home Forums ACF PRO Problem with acf google map Reply To: Problem with acf google map

  • Heya,
    Gonna jump in on this thread because I’m having the same problem. Trying to implement Googlemaps for the first time, have followed the instructions, but getting nothing on the front-end. Not sure if McPersonProject got his/her working, but here’s what I’ve got.

    Functions.php :

    wp_register_script( 'wl-googlemaps-api', '//maps.googleapis.com/maps/api/js?v=3.exp&sensor=false'); 
    	wp_register_script( 'wl-googlemaps', get_template_directory_uri() . '/js/googlemaps.js'); 
    	if ( is_singular() ) {
    		wp_enqueue_script( 'wl-googlemaps-api' );
    		wp_enqueue_script( 'wl-googlemaps' );
    	}

    Have tried removing conditional, no change.

    In my template :

    <?php 
    
        $location = get_field( 'map' );
    
        if( !empty( $location ) ){ ?>
            <div class="acf-map">
                <div class="marker" data-lat="<?php echo $location['lat']; ?>" data-lng="<?php echo $location['lng']; ?>"></div>
            </div>
        <?php } ?>

    I see the grey box whether or not there is a map defined.
    Have double-triple checked my variable names.
    js/googlemaps.js contains the script you provided, no html.
    I do see both scripts loading, not sure what I’m doing wrong 🙁

    thnx!
    -jennyb