Home › Forums › ACF PRO › Hide marker on Google map › Reply To: Hide marker on Google map
Almost.. I noticed ACF does not do anything for placing an empty map at a specific location so you need to do a bit more tweaking.
This should be your HTML/PHP
<?php
$location = get_field('location');
if( !empty($location) ):
?>
<div class="acf-map" data-lat="<?php echo $location['lat']; ?>" data-lng="<?php echo $location['lng']; ?>">
</div>
<?php endif; ?>
And in the render_map javascript function change the var args
part to
var map_lat = $el.data('lat');
var map_lng = $el.data('lng');
// vars
var args = {
zoom : 16,
center : new google.maps.LatLng(map_lat, map_lng),
mapTypeId : google.maps.MapTypeId.ROADMAP
};
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.