-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.php
47 lines (42 loc) · 1.43 KB
/
index.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
<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>
<body onload="initialize()">
<?php if ( have_posts() ) : ?>
<!-- WordPress has found matching posts -->
<div style="display: none;">
<?php $i = 1; ?>
<?php while ( have_posts() ) : the_post(); ?>
<?php if ( get_post_meta($post->ID, 'latlng', true) !== '' ) : ?>
<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_post_meta($post->ID, 'latlng', true) !== '' ) : ?>
{
latlng : new google.maps.LatLng<?php echo get_post_meta($post->ID, 'latlng', true); ?>,
info : document.getElementById('item<?php echo $i; ?>')
},
<?php endif; ?>
<?php $i++; endwhile; ?>
];
</script>
<div id="map" style="width: 100%; height: 100%;"></div>
<?php else : ?>
<!-- No matching posts, show an error -->
<h1>Error 404 — Page not found.</h1>
<?php endif; ?>
<?php wp_footer(); ?>
</body>
</html>