forked from vanbexlabs/hackathon-wordpress-theme
-
Notifications
You must be signed in to change notification settings - Fork 0
/
part-events-map.php
60 lines (59 loc) · 1.91 KB
/
part-events-map.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
48
49
50
51
52
53
54
55
56
57
58
59
60
<section class="home-search-events home-events">
<?php
$map_id = get_field('map');
$hero_buttons = get_field('hero_buttons');
?>
<?php
if (!empty($map_id)): ?>
<div id="map"></div>
<script type="text/javascript">
var map = L.mapbox.map('map', '<?php echo $map_id; ?>')
map.touchZoom.disable();
map.doubleClickZoom.disable();
map.scrollWheelZoom.disable();
// disable tap handler, if present.
if (map.tap) map.tap.disable();
</script>
<?php endif; ?>
<div class="container map-inner cf">
<div class="left">
<h2>
<?php
$numberEvents = wp_count_posts('event')->publish;
$numberCities = count($locations);
?>
Featured<br>
<strong>Events</strong>
</h2>
</div>
<ul class="event-locations">
<?php
$args = array(
'post_type' => 'event',
'orderby' => 'post_date',
'order' => 'DESC',
'numberposts' => '-1'
);
$posts = get_posts($args); shuffle($posts); ?>
<?php if (count($posts) > 0): $n = 0; foreach($posts as $post): setup_postdata($post); ?>
<li>
<a href="<?php the_permalink(); ?>" title="<?php the_title();?>">
<span><?php the_title();?></span>
</a>
</li>
<?php if ($n++ > 5) break; ?>
<?php endforeach; ?>
<li>
<a href="<?php bloginfo('url'); ?>/events/" class="all-link">
<span>View All Events</span>
</a>
</li>
<?php endif; wp_reset_query(); ?>
</ul>
</div>
<?php
if (!empty($map_id)): ?>
<div class="map-overlay"></div>
<a href="#" class="trigger-map small">View Map</a>
<?php endif; ?>
</section>