amitabhaghosh197
9/5/2014 - 1:31 PM

Google Map API js for wordpress

Google Map API js for wordpress

<?php


function google_map_js(){?>
	
   <?php if (is_page(403)) { ?>
   
   
 
	 <script type="text/javascript" src="http://maps.googleapis.com/maps/api/js?sensor=false"></script>
	
			  <script>
			  <?php $options = get_option('redux_demo');  ?>
			  
       function initialize() {
  var myLatlng = new google.maps.LatLng(<?php echo of_get_option( 'lat_text' ); ?>,<?php echo of_get_option( 'lon_text' ); ?>);
  var mapOptions = {
    zoom: 15,
    center: myLatlng
  }
  var map = new google.maps.Map(document.getElementById('map-canvas'), mapOptions);

  var marker = new google.maps.Marker({
      position: myLatlng,
      map: map,
      title: '<?php echo of_get_option( 'tittt_text' ); ?>'
  });
  google.maps.event.addDomListener(window, 'resize', function() {
    map.setCenter(center);
}); // This is for centering the Map for responsive devices
}



    
google.maps.event.addDomListener(window, 'load', initialize);

    
            </script>

	   <?php  } ?>
	
	<?php }

add_action('wp_head', 'google_map_js');