Support

Account

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
    };