$latitude = $show_details[0]->latitude;
//$longitude = $show_details[0]['longitude'];
//var_dump($latitude);
$coordinates = array();
$coordinates = array('lat' => $latitude, 'lng' => $longitude);
//$coordinates="ddd";
//var_dump($coordinates);
?>

	<script type="text/javascript">var address = "<?php 
echo esc_js($make_address);
?>
";</script>

	<?php 
cp_google_maps_js($coordinates);
?>

	<!-- google map div -->
	<div id="map"></div>

</div>


<?php 
// Google map on single page
function cp_google_maps_js($coordinates)
{
    //var_dump($coordinates);
    ?>
<script type='text/javascript' src='http://maps.googleapis.com/maps/api/js?sensor=false&#038;language=en&#038;region=US&#038;ver=3.0'></script>
Пример #2
0
    <?php 
// check to see if ad is legacy or not and then assemble the map address
if (get_post_meta($post->ID, 'location', true)) {
    $make_address = get_post_meta($post->ID, 'location', true);
} else {
    $make_address = get_post_meta($post->ID, 'cp_street', true) . '&nbsp;' . get_post_meta($post->ID, 'cp_city', true) . '&nbsp;' . get_post_meta($post->ID, 'cp_state', true) . '&nbsp;' . get_post_meta($post->ID, 'cp_zipcode', true);
}
?>

    <script type="text/javascript">var address = "<?php 
echo esc_js($make_address);
?>
";</script>

    <?php 
cp_google_maps_js();
?>

    <!-- google map div -->
    <div id="map"></div>

</div>


<?php 
// Google map on single page
function cp_google_maps_js()
{
    ?>
 <script type="text/javascript">
//<![CDATA[