Created
July 30, 2013 20:48
-
-
Save andresfelipemendezt/6116788 to your computer and use it in GitHub Desktop.
how to and in the front end the custom field location addon with the google mas api V3
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
Template Name: INICIO | |
*/ | |
?> | |
<style> | |
#map-canvas { | |
margin: 0; | |
padding: 0; | |
height: 100%; | |
} | |
</style> | |
<script src="https://maps.googleapis.com/maps/api/js?v=3.exp&sensor=false"></script> | |
<?php get_header(); ?> | |
<?php echo do_shortcode('[slider id=62 name="indexbanner"]'); ?> | |
<?php echo do_shortcode('[print_thumbnail_slider]'); ?> | |
<?php while (have_posts()) : the_post(); ?> | |
<?php the_content(); ?> | |
<?php endwhile;?> | |
<script> | |
var map; | |
var myLatLang = new google.maps.LatLng( <?php $location = get_field('google_maps'); echo $location['coordinates']; ?>); | |
function initialize() { | |
var mapOptions = { | |
zoom: 8, | |
center: myLatLang, | |
mapTypeId: google.maps.MapTypeId.ROADMAP | |
}; | |
map = new google.maps.Map(document.getElementById('map-canvas'), | |
mapOptions); | |
var marker = new google.maps.Marker({ | |
position: myLatLang, | |
map: map, | |
title:"Hello World!" | |
}); | |
}; | |
google.maps.event.addDomListener(window, 'load', initialize); | |
</script> | |
<div id="map-canvas"></div> | |
<?php get_footer(); ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment