Skip to content

Instantly share code, notes, and snippets.

@designbuildtest
Created September 22, 2015 11:11
Show Gist options
  • Select an option

  • Save designbuildtest/5a2e962fed23dde5d414 to your computer and use it in GitHub Desktop.

Select an option

Save designbuildtest/5a2e962fed23dde5d414 to your computer and use it in GitHub Desktop.
Google Maps example - with marker and custom controls
<div id="map" style="height:600px"></div>
<script>
function initMap() {
var myLatLng = { lat: <?php esc_attr_e( sing_post_latitude() ); ?>, lng: <?php esc_attr_e( sing_post_longitude() ); ?> };
var map = new google.maps.Map(document.getElementById('map'), {
center: myLatLng,
scrollwheel: false,
disableDoubleClickZoom: true,
streetViewControl: false,
mapTypeControl: false,
zoom: 12,
});
var marker = new google.maps.Marker({
position: myLatLng,
map: map,
title: '<?php the_title(); ?>'
});
}
</script>
<script async defer src="https://maps.googleapis.com/maps/api/js?callback=initMap"></script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment