I did a small test for the google map API. But it doesn't show in the WordPress. Basically, I copy and paste one sample code in the file. Codes address: http://stackoverflow.com/questions/11637755/google-map-api-in-wordpress-without-a-plugin In the header.php:
<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script>
In the template of my plugin:
<script type="text/javascript">
function initialize() {
var leeds = new google.maps.LatLng(53.80583, -1.548903);
var firstLatlng = new google.maps.LatLng(53.80583, -1.548903);
var firstOptions = {
zoom: 16,
center: firstLatlng,
mapTypeId: google.maps.MapTypeId.ROADMAP
};
var map = new google.maps.Map(document.getElementById("map_leeds"), firstOptions);
firstmarker = new google.maps.Marker({
map:map,
draggable:false,
animation: google.maps.Animation.DROP,
title: 'Your Client',
position: leeds
});
var contentString1 = '<p>The Address<br />Of your client<br />in<br />here</p>';
var infowindow1 = new google.maps.InfoWindow({
content: contentString1
});
google.maps.event.addListener(firstmarker, 'click', function() {
infowindow1.open(map,firstmarker);
});
}
</script>
<div class="map">
<div id="map_leeds" style="width: 600px; height: 600px"></div>
</div>
But it doesn't work. Could someone point out which part I did wrong?
Thank you for helping!
initialize()? – Milo Mar 20 at 15:27