guillermorangel
4/29/2015 - 4:49 PM

Code for ACF Google Map layout, placement and rendering

Code for ACF Google Map layout, placement and rendering

<?php
  // get the google map field named 'address'
  $address = '';
  $address = get_field('google_map_field_name');
  
  <?php if ( !empty($address) ) : ?>
  <div class="map_container">
      
      <!-- the button to 'disable' the map -->
      <div class="disable_map_btn hide"><span class="fa fa-times"></span> Disable Map</div>
      
      <!-- the google map will be rendered in .acf-map below -->
      <div class="acf-map">
          <div class="marker" data-lat="<?php echo $address['lat']; ?>" data-lng="<?php echo $address['lng']; ?>"></div>
      </div>
  </div>
  <?php endif; ?>
?>