I am trying to display a google map using short code for a plugin I am building, but I can not get it to work. Does anyone have some advice on this? Here is my code:
add_shortcode( 'show_map', array('hotSpot', 'create_map'));
function create_map() {
?>
<script src="https://maps.googleapis.com/maps/api/js"></script>
<script>
function initialize() {
var map_canvas = document.getElementById('map_canvas');
var map_options = {
center: new google.maps.LatLng(34.040819,-84.604660),
zoom: 14,
mapTypeId: google.maps.MapTypeId.ROADMAP
}
var map = new google.maps.Map(map_canvas, map_options)
}
google.maps.event.addDomListener(window, 'load', initialize);
</script>
<?php
return '<div id="map_canvas"></div>';
}
class?