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
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.