Last active
December 22, 2015 03:18
-
-
Save JacobHsu/6408852 to your computer and use it in GitHub Desktop.
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
<html> | |
<head> | |
<title>Maps Test</title> | |
<script type="text/javascript" src="http://maps.googleapis.com/maps/api/js?sensor=false"></script> | |
<script type="text/javascript" src="<?php echo get_stylesheet_directory_uri() ?>/map.js"></script> | |
<?php wp_head(); ?> | |
</head> | |
<?php echo get_geocode_latlng($post->ID)."===".$post->ID; ?> | |
<body onload="initialize()"> | |
<?php //echo get_geocode_latlng($post->ID); ?> | |
<?php //echo the_title(); ?> | |
<!-- WordPress has found matching posts --><!--輸出文章網址--> | |
<?php if ( have_posts() ) : ?> | |
<div style="display: none;"> | |
<?php $i = 1; ?> | |
<?php while ( have_posts() ) : the_post(); ?> | |
<?php if ( get_geocode_latlng($post->ID) !== '' ) : ?> | |
<div id="item<?php echo $i; ?>"> | |
<p><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></p> | |
<?php the_content(); ?> | |
</div> | |
<?php endif; ?> | |
<?php $i++; ?> | |
<?php endwhile; ?> | |
</div> | |
<script type="text/javascript"> | |
var locations = [ | |
<?php $i = 1; while ( have_posts() ) : the_post(); ?> | |
<?php if ( get_geocode_latlng($post->ID) !== '' ) : ?> | |
{ | |
latlng : new google.maps.LatLng<?php echo get_geocode_latlng($post->ID); ?>, | |
info : document.getElementById('item<?php echo $i; ?>') | |
}, | |
<?php endif; ?> | |
<?php $i++; endwhile; ?> | |
]; | |
</script> | |
<div id="map" style="width: 100%; height: 80%;"></div> | |
<?php else : ?> | |
<!-- No matching posts, show an error --> | |
<h1>Error 404 — Page not found.</h1> | |
<?php endif; ?> | |
<?php wp_footer(); ?> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment