Project

General

Profile

Feature #4531 » index.php

Alex Hills, 2015-09-04 01:44 PM

 
1
<!DOCTYPE html>
2
<html>
3
<head>
4
	<meta name="viewport" content="width=device-width, initial-scale=1">
5
	<meta charset='UTF-8'>
6
	<link rel="icon" href="<?php echo get_stylesheet_directory_uri(); ?>/favicon.ico" />
7
	<title><?php wp_title('&raquo;','true','right'); ?><?php bloginfo('name'); ?></title>
8
	<?php wp_head(); ?>
9
</head>
10
<body>
11
	<?php if(is_page('splash')){ ?>
12
		<div class="backgrounds">
13
			<?php
14
			$images = get_field('background_images');
15
			if($images):
16
				foreach($images as $image): ?>
17
					<div class="backgroundImage" style="background-image: url(<?php echo $image['url']; ?>)">
18
						<div class="backgroundImageCaption">
19
							<?php echo $image['caption']; ?>
20
						</div>
21
					</div>
22
				<?php endforeach; ?>
23
			<?php endif; ?>
24
		</div>
25
		<div class="container splash">
26

    
27
			<?php
28
			$top = get_field('top_splash');
29
			if($top): ?>
30
				<div class="top">
31
					<?php the_field('top_splash');?>
32
				</div>
33
			<?php endif; ?>
34

    
35
			<div class="thelogo">
36
				<?php 
37
				$link_on = get_field('turn_on_logo_link');
38
				if($link_on == 'true'){ ?>
39
					<a href="<?php the_field('logo_links_to'); ?>"><img src="<?php the_field('splash_logo'); ?>"></a>
40
				<?php } else { ?>
41
					<img src="<?php the_field('splash_logo'); ?>">
42
				<?php }; ?>
43
				
44
			</div>
45

    
46
			<?php
47
			$bottom = get_field('bottom_splash');
48
			if($bottom): ?>
49
				<div class="bottom">
50
					<?php the_field('bottom_splash');?>
51
				</div>
52
			<?php endif; ?>
53

    
54
		</div>
55

    
56
	<?php } else { ?>
57
		<div class="container">
58
			<div id="masthead">
59
				<div id="header">
60
					<div id="left_and_right">
61
						<div class="left_header">
62
							<?php the_field('segal_presents', 'options'); ?>
63
							<br />
64
							<div class="logo">
65
								<?php 
66

    
67
								$image = get_field('prelude_logo', 'options');
68

    
69
								if( !empty($image) ): ?>
70
									<?php $url = home_url( '/' ); ?>
71
									<a href="<?php echo $url; ?>">
72
									<img src="<?php echo $image['url']; ?>" alt="<?php echo $image['alt']; ?>" /></a>
73

    
74
								<?php endif; ?>
75
							</div>
76
						</div>
77
						<div class="right_header">
78
							<div class="dates_img">
79
								<?php 
80

    
81
								$image = get_field('dates_image', 'options');
82

    
83
								if( !empty($image) ): ?>
84

    
85
									<img src="<?php echo $image['url']; ?>" alt="<?php echo $image['alt']; ?>" />
86

    
87
								<?php endif; ?>
88
							</div>
89
							<div class="admission_image">
90
								<?php 
91

    
92
								$image = get_field('admission_image', 'options');
93

    
94
								if( !empty($image) ): ?>
95

    
96
									<img src="<?php echo $image['url']; ?>" alt="<?php echo $image['alt']; ?>" />
97

    
98
								<?php endif; ?>
99
							</div>
100
						</div>
101
					</div>
102
				</div>
103
				<div id="nav">
104
					<?php wp_nav_menu( array( 'theme_location' => 'header-menu' ) ); ?>
105
				</div>
106
				<div id="banner_image">
107
					<?php 
108

    
109
					$post_type = get_post_type();
110
					if($post_type == 'performance' || $post_type == 'exhibition' || $post_type == 'panel'){ ?>
111
						<?php $schedule = get_page_by_path('schedule', OBJECT, 'page');
112
						$image = get_field('sections_banner_image', $schedule->ID);
113
						if( !empty($image) ): ?>
114
							<img src="<?php echo $image['url']; ?>" alt="<?php echo $image['alt']; ?>" />
115
						<?php endif; ?>
116
					<?php } elseif($post_type == 'artist') { ?>
117
						<?php $artist = get_page_by_path('artists', OBJECT, 'page');
118
						$image = get_field('sections_banner_image', $artist->ID);
119
						if( !empty($image) ): ?>
120
							<img src="<?php echo $image['url']; ?>" alt="<?php echo $image['alt']; ?>" />
121
						<?php endif; ?>
122
					<?php } else { ?>
123
						<?php
124
						$parent = array_reverse(get_post_ancestors($post->ID));
125
						$first_parent = get_page($parent[0]);
126
						$parent_id = $first_parent->ID;
127
						$image = get_field('sections_banner_image', $parent_id);
128
						if( !empty($image) ): ?>
129
							<img src="<?php echo $image['url']; ?>" alt="<?php echo $image['alt']; ?>" />
130
						<?php endif; ?>
131
					<?php }; ?>
132
				</div>
133
			</div>
134
			<div id="content_container">
135

    
136
				<?php
137
				$parent = array_reverse(get_post_ancestors($post->ID));
138
				$first_parent = get_page($parent[0]);
139
				$parent_id = $first_parent->ID;
140
				$parent_title = get_the_title($parent_id);
141
				if($parent_title == 'About'){
142
					wp_nav_menu( array(
143
						'menu' => 'About Menu',
144
						'container_class' => 'page_navigation'
145
					));
146
				} elseif($parent_title == 'Schedule'){
147
					wp_nav_menu( array(
148
						'menu' => 'Schedule Menu',
149
						'container_class' => 'page_navigation'
150
					));
151
				}; ?>
152
				<?php if( have_rows('content_fields') ): ?>
153
					<div id="content">
154
				    <?php while ( have_rows('content_fields') ) : the_row();
155
				        if( get_row_layout() == 'text' ): ?>
156
				        	<div class="entry-content">
157
				        		<?php the_sub_field('text_content'); ?>
158
				        	</div>
159
				        <?php elseif( get_row_layout() == 'expandable_content' ): ?>
160
				        	<div class="expandable">
161
				        		<div class="expand_title"><div class="plus_or_minus expand_plus">+</div><?php the_sub_field('expand_title'); ?></div>
162
	            				<div class="expand_content"><?php the_sub_field('expand_content'); ?></div>
163
	            				<br clear="all">
164
				        	</div>
165
				        <?php elseif( get_row_layout() == 'google_map' ): ?>
166
				        	<?php 
167

    
168
							$location = get_sub_field('the_map');
169

    
170
							if( !empty($location) ):
171
							?>
172
							<div class="acf-map">
173
								<div class="marker" data-lat="<?php echo $location['lat']; ?>" data-lng="<?php echo $location['lng']; ?>"></div>
174
							</div>
175
							<?php endif; ?>
176
				        <?php endif;
177
				    endwhile; ?>
178
				    </div>
179
				<?php else : ?>
180
				<?php endif; ?>
181

    
182
				<?php if(is_page('artists')){ ?>
183
					<?php
184
					$artists = get_posts(array(
185
						'post_type' => 'artist',
186
						'orderby' => 'title',
187
						'order' => 'ASC',
188
						'posts_per_page' => -1
189
					));
190
					?>
191
					<?php if( $artists ): ?>
192
						<ul class="artist_list">
193
						<?php foreach( $artists as $post ): 
194
							setup_postdata($post); ?>
195
							<li>
196
								<a href="<?php the_permalink(); ?>"><?php the_title(); ?></a>
197
							</li>
198
						<?php endforeach; ?>
199
						<?php wp_reset_postdata(); ?>
200
						</ul>
201
					<?php endif; ?>
202
				<?php }; ?>
203

    
204

    
205
				<!--BEGIN SCHEDULE SECTION-->
206
				<?php if(is_page(array(
207
						'schedule', 'performances', 'panels', 'exhibitions'
208
					))){ ?>
209
					<?php
210
					if(is_page('schedule')){
211
						$events = get_posts(array(
212
							'post_type' => array('performance', 'panel', 'exhibition'),
213
							'posts_per_page' => -1,
214
							'meta_query' => array(
215
								'date_clause' => array(
216
									'key' => 'date',
217
									'compare' => 'EXISTS'
218
								),
219
								'hour_clause' => array(
220
									'key' => 'start_hour',
221
									'compare' => 'EXISTS'
222
								),
223
								'minute_clause' => array(
224
									'key' => 'start_minute',
225
									'compare' => 'EXISTS'
226
								)
227
						        
228
						    ),
229
						    'orderby' => array(
230
						    	'date_clause' => 'ASC',
231
						    	'hour_clause' => 'ASC',
232
						    	'minute_clause' => 'ASC',
233
						    )			
234
						));
235
					} elseif(is_page('performances')){
236
						$events = get_posts(array(
237
							'post_type' => array('performance'),
238
							'posts_per_page' => -1,
239
							'meta_query' => array(
240
								'date_clause' => array(
241
									'key' => 'date',
242
									'compare' => 'EXISTS'
243
								),
244
								'hour_clause' => array(
245
									'key' => 'start_hour',
246
									'compare' => 'EXISTS'
247
								),
248
								'minute_clause' => array(
249
									'key' => 'start_minute',
250
									'compare' => 'EXISTS'
251
								)
252
						        
253
						    ),
254
						    'orderby' => array(
255
						    	'date_clause' => 'ASC',
256
						    	'hour_clause' => 'ASC',
257
						    	'minute_clause' => 'ASC',
258
						    )			
259
						));
260
					} elseif(is_page('panels')){
261
						$events = get_posts(array(
262
							'post_type' => array('panel'),
263
							'posts_per_page' => -1,
264
							'meta_query' => array(
265
								'date_clause' => array(
266
									'key' => 'date',
267
									'compare' => 'EXISTS'
268
								),
269
								'hour_clause' => array(
270
									'key' => 'start_hour',
271
									'compare' => 'EXISTS'
272
								),
273
								'minute_clause' => array(
274
									'key' => 'start_minute',
275
									'compare' => 'EXISTS'
276
								)
277
						        
278
						    ),
279
						    'orderby' => array(
280
						    	'date_clause' => 'ASC',
281
						    	'hour_clause' => 'ASC',
282
						    	'minute_clause' => 'ASC',
283
						    )			
284
						));
285
					} elseif(is_page('exhibitions')){
286
						$events = get_posts(array(
287
							'post_type' => array('exhibition'),
288
							'posts_per_page' => -1,
289
							'meta_query' => array(
290
								'date_clause' => array(
291
									'key' => 'date',
292
									'compare' => 'EXISTS'
293
								),
294
								'hour_clause' => array(
295
									'key' => 'start_hour',
296
									'compare' => 'EXISTS'
297
								),
298
								'minute_clause' => array(
299
									'key' => 'start_minute',
300
									'compare' => 'EXISTS'
301
								)
302
						        
303
						    ),
304
						    'orderby' => array(
305
						    	'date_clause' => 'ASC',
306
						    	'hour_clause' => 'ASC',
307
						    	'minute_clause' => 'ASC',
308
						    )			
309
						));
310
					};
311
					?>
312

    
313
				
314
					<?php if( $events): ?>
315
						<div id="content">
316
							<div class="event_list">
317
							<?php foreach( $events as $post ):
318
								setup_postdata($post); ?>
319
								<div class="single_event">
320
									<div class="date_and_time">
321
										<?php the_field('date'); ?><br>
322

    
323
										<?php
324
										$the_start_hour = get_field('start_hour');
325
										if($the_start_hour >= 12){
326
											if($the_start_hour > 12){
327
												$the_start_hour = $the_start_hour - 12;
328
											} elseif ($the_start_hour == 12){
329
												$the_start_hour = 12;
330
											};
331
											$am_or_pm = 'pm';
332
										} elseif($the_start_hour == 0){
333
											$the_start_hour = $the_start_hour + 12;
334
											$am_or_pm = 'am';
335
										} elseif($the_start_hour < 12 && $the_start_hour > 0){
336
											$am_or_pm = 'am';
337
										};
338
										if($the_start_hour < 10) {
339
											$the_start_hour = ltrim($the_start_hour, '0');
340
										};
341
										?>
342

    
343
										<?php
344
										$the_end_hour = get_field('end_hour');
345
										if($the_end_hour >= 12){
346
											if($the_end_hour > 12){
347
												$the_end_hour = $the_end_hour - 12;
348
											} elseif ($the_end_hour == 12){
349
												$the_end_hour = 12;
350
											};
351
											$am_or_pm = 'pm';
352
										} elseif($the_end_hour == 0){
353
											$the_end_hour = $the_end_hour + 12;
354
											$am_or_pm = 'am';
355
										} elseif($the_end_hour < 12 && $the_end_hour > 0){
356
											$am_or_pm = 'am';
357
										};
358
										if($the_end_hour < 10) {
359
											$the_end_hour = ltrim($the_end_hour, '0');
360
										};
361
										?>
362

    
363
										<?php echo $the_start_hour; ?>:<?php the_field('start_minute'); ?><?php echo $am_or_pm; ?>&ndash;<?php echo $the_end_hour; ?>:<?php the_field('end_minute'); ?><?php echo $am_or_pm; ?>
364
									</div>
365
									<div class="right_event_col">
366
										<div class="event_type"><?php echo get_post_type(); ?></div>
367
										<h2><a href="<?php the_permalink(); ?>" class="<?php echo get_post_type();?>"><?php the_title(); ?></a></h2>
368
										<?php $artists = get_field('artist'); ?>
369
										<?php if( $artists ){ ?>
370
										<div class="artists">
371
											<ul class="performance_artist schedule">
372
											<?php foreach( $artists as $post ){
373
												setup_postdata($post); ?>
374
												<li class="artist">
375
													<a href="<?php the_permalink(); ?>"><?php the_title(); ?></a><br>
376
												</li>
377
											<?php }; ?>
378
											</ul>
379
											<?php wp_reset_postdata(); ?>
380
										</div>
381
										<?php }; ?>
382
									</div>
383
								</div>
384
							<?php endforeach; ?>
385
							<?php wp_reset_postdata(); ?>
386

    
387
							<?php if(is_page('exhibitions') || is_page('performances') || is_page('panels')){
388
							} else { ?>
389

    
390
								<?php $closing_party = get_page_by_path('schedule/closing-party', OBJECT, 'page');
391
								$closing_id = $closing_party->ID;
392
								if($closing_id){ ?>
393

    
394
									<div class="single_event">
395
										<div class="date_and_time">
396
											<?php the_field('date', $closing_id); ?><br>
397

    
398
											<?php
399
											$the_start_hour = get_field('start_hour', $closing_id);
400
											if($the_start_hour >= 12){
401
												if($the_start_hour > 12){
402
													$the_start_hour = $the_start_hour - 12;
403
												} elseif ($the_start_hour == 12){
404
													$the_start_hour = 12;
405
												};
406
												$am_or_pm = 'pm';
407
											} elseif($the_start_hour == 0){
408
												$the_start_hour = $the_start_hour + 12;
409
												$am_or_pm = 'am';
410
											} elseif($the_start_hour < 12 && $the_start_hour > 0){
411
												$am_or_pm = 'am';
412
											};
413
											if($the_start_hour < 10) {
414
												$the_start_hour = ltrim($the_start_hour, '0');
415
											};
416
											?>
417

    
418
											<?php
419
											$the_end_hour = get_field('end_hour', $closing_id);
420
											if($the_end_hour >= 12){
421
												if($the_end_hour > 12){
422
													$the_end_hour = $the_end_hour - 12;
423
												} elseif ($the_end_hour == 12){
424
													$the_end_hour = 12;
425
												};
426
												$am_or_pm = 'pm';
427
											} elseif($the_end_hour == 0){
428
												$the_end_hour = $the_end_hour + 12;
429
												$am_or_pm = 'am';
430
											} elseif($the_end_hour < 12 && $the_end_hour > 0){
431
												$am_or_pm = 'am';
432
											};
433
											if($the_end_hour < 10) {
434
												$the_end_hour = ltrim($the_end_hour, '0');
435
											};
436
											?>
437

    
438
											<?php echo $the_start_hour; ?>:<?php the_field('start_minute', $closing_id); ?><?php echo $am_or_pm; ?>&ndash;<?php echo $the_end_hour; ?>:<?php the_field('end_minute', $closing_id); ?><?php echo $am_or_pm; ?>
439
										</div>
440
										<div class="right_event_col">
441
											<div class="event_type">&nbsp;</div>
442
											<h2><a href="<?php echo get_the_permalink($closing_party->ID); ?>"><?php echo get_the_title($closing_party->ID); ?></a></h2>
443
											<?php $artists = get_field('artist', $closing_id); ?>
444
											<?php if( $artists ){ ?>
445
											<div class="artists">
446
												<ul class="performance_artist schedule">
447
												<?php foreach( $artists as $post ){
448
													setup_postdata($post); ?>
449
													<li class="artist">
450
														<a href="<?php the_permalink(); ?>"><?php the_title(); ?></a><br>
451
													</li>
452
												<?php }; ?>
453
												</ul>
454
												<?php wp_reset_postdata(); ?>
455
											</div>
456
											<?php }; ?>
457
										</div>
458
									</div>
459
								<?php }; ?>
460
							<?php }; ?>
461

    
462

    
463
							</div>
464
						</div>
465
					<?php endif; ?>
466
				<?php }; ?>
467
				<!--END SCHEDULE SECTION-->
468

    
469
				<?php 
470

    
471
				$post_type = get_post_type();
472
				$post_name = get_query_var('name');
473
				if($post_type == 'performance' || $post_type == 'panel' || $post_type == 'exhibition' || $post_name == 'closing-party'){ ?>
474
					<?php $artists = get_field('artist'); ?>
475
					<div id="content">
476
						<div class="performance_title">
477
							<h2><?php echo the_title(); ?></h2>
478
						</div>
479
						
480
						<div class="performance_date">
481
							<?php the_field('date'); ?><br>
482
							<?php
483
							$the_start_hour = get_field('start_hour');
484
							if($the_start_hour >= 12){
485
								if($the_start_hour > 12){
486
									$the_start_hour = $the_start_hour - 12;
487
								} elseif ($the_start_hour == 12){
488
									$the_start_hour = 12;
489
								};
490
								$am_or_pm = 'pm';
491
							} elseif($the_start_hour == 0){
492
								$the_start_hour = $the_start_hour + 12;
493
								$am_or_pm = 'am';
494
							} elseif($the_start_hour < 12 && $the_start_hour > 0){
495
								$am_or_pm = 'am';
496
							};
497
							if($the_start_hour < 10) {
498
								$the_start_hour = ltrim($the_start_hour, '0');
499
							};
500
							?>
501

    
502
							<?php
503
							$the_end_hour = get_field('end_hour');
504
							if($the_end_hour >= 12){
505
								if($the_end_hour > 12){
506
									$the_end_hour = $the_end_hour - 12;
507
								} elseif ($the_end_hour == 12){
508
									$the_end_hour = 12;
509
								};
510
								$am_or_pm = 'pm';
511
							} elseif($the_end_hour == 0){
512
								$the_end_hour = $the_end_hour + 12;
513
								$am_or_pm = 'am';
514
							} elseif($the_end_hour < 12 && $the_end_hour > 0){
515
								$am_or_pm = 'am';
516
							};
517
							if($the_end_hour < 10) {
518
								$the_end_hour = ltrim($the_end_hour, '0');
519
							};
520
							?>
521

    
522
							<?php echo $the_start_hour; ?>:<?php the_field('start_minute'); ?><?php echo $am_or_pm; ?>&ndash;<?php echo $the_end_hour; ?>:<?php the_field('end_minute'); ?><?php echo $am_or_pm; ?>
523
						</div>
524

    
525
						<div class="performance_location">
526
							<?php the_field('location'); ?>
527
						</div>
528

    
529
						<?php
530
						$description = get_field('description'); 
531
						if($description){ ?>
532
							<div class="performance_description">
533
								<?php echo $description; ?>
534
							</div>
535
						<?php };
536
						?>
537
						<?php if( $artists ){ ?>
538
						<div class="artists">
539
							<ul class="performance_artist">
540
							<?php foreach( $artists as $post ){
541
								setup_postdata($post); ?>
542
								<li class="artist">
543
									<a href="<?php the_permalink(); ?>"><?php the_title(); ?></a><br>
544
									<?php $image = get_field('artist_image');
545
									if( !empty($image) ): ?>
546
										<img style="float:right; padding:0 0 20px 20px; width:33%; height:auto;" src="<?php echo $image['url']; ?>" alt="<?php echo $image['alt']; ?>" />
547
									<?php endif; ?>
548
									<?php the_field('artist_bio'); ?>
549
								</li>
550
							<?php }; ?>
551
							</ul>
552
							<?php wp_reset_postdata(); ?>
553
						</div>
554
						<?php }; ?>
555
					</div>
556
				<?php } elseif($post_type == 'artist'){ ?>
557
					<div id="content" class="artist_listing">
558
						<div class="artist_name">
559
							<h2><?php echo the_title(); ?></h2>
560
						</div>
561
						<div class="artist_bio">
562
							<?php $image = get_field('artist_image');
563
							if( !empty($image) ): ?>
564
								<img style="float:right; padding:0 0 20px 20px; width:33%; height:auto;" src="<?php echo $image['url']; ?>" alt="<?php echo $image['alt']; ?>" />
565
							<?php endif; ?>
566
							<?php the_field('artist_bio'); ?>
567
						</div>
568
						<div class="artists_events">
569
							<?php
570
							$performances = get_posts(array(
571
								'post_type' => 'performance',
572
								'posts_per_page' => -1,
573
								'meta_query' => array(
574
									array(
575
										'key' => 'artist',
576
										'value' => '"' . get_the_ID() . '"',
577
										'compare' => 'LIKE'
578
										)
579
									),
580
								'orderby' => 'meta_value',
581
								'meta_key' => 'date',
582
								'order' => 'ASC'
583
							));
584
							?>
585
							<?php
586
							$panels = get_posts(array(
587
								'post_type' => 'panel',
588
								'posts_per_page' => -1,
589
								'meta_query' => array(
590
									array(
591
										'key' => 'artist',
592
										'value' => '"' . get_the_ID() . '"',
593
										'compare' => 'LIKE'
594
										)
595
									),
596
								'orderby' => 'meta_value',
597
								'meta_key' => 'date',
598
								'order' => 'ASC'
599
							));
600
							?>
601
							<?php
602
							$exhibitions = get_posts(array(
603
								'post_type' => 'exhibition',
604
								'posts_per_page' => -1,
605
								'meta_query' => array(
606
									array(
607
										'key' => 'artist',
608
										'value' => '"' . get_the_ID() . '"',
609
										'compare' => 'LIKE'
610
										)
611
									),
612
								'orderby' => 'meta_value',
613
								'meta_key' => 'date',
614
								'order' => 'ASC'
615
							));
616
							?>
617
							<?php if( $performances ): ?>
618
								<h2>Performances</h2>
619
								<ul>
620
								<?php foreach( $performances as $post ): 
621
									setup_postdata($post); ?>
622
									<li>
623
										<a class="<?php echo get_post_type(); ?>" href="<?php the_permalink(); ?>"><?php the_title(); ?></a><br>
624
										<?php the_field('date'); ?><br>
625
										<?php
626
										$the_start_hour = get_field('start_hour');
627
										if($the_start_hour >= 12){
628
											if($the_start_hour > 12){
629
												$the_start_hour = $the_start_hour - 12;
630
											} elseif ($the_start_hour == 12){
631
												$the_start_hour = 12;
632
											};
633
											$am_or_pm = 'pm';
634
										} elseif($the_start_hour == 0){
635
											$the_start_hour = $the_start_hour + 12;
636
											$am_or_pm = 'am';
637
										} elseif($the_start_hour < 12 && $the_start_hour > 0){
638
											$am_or_pm = 'am';
639
										};
640
										if($the_start_hour < 10) {
641
											$the_start_hour = ltrim($the_start_hour, '0');
642
										};
643
										?>
644

    
645
										<?php
646
										$the_end_hour = get_field('end_hour');
647
										if($the_end_hour >= 12){
648
											if($the_end_hour > 12){
649
												$the_end_hour = $the_end_hour - 12;
650
											} elseif ($the_end_hour == 12){
651
												$the_end_hour = 12;
652
											};
653
											$am_or_pm = 'pm';
654
										} elseif($the_end_hour == 0){
655
											$the_end_hour = $the_end_hour + 12;
656
											$am_or_pm = 'am';
657
										} elseif($the_end_hour < 12 && $the_end_hour > 0){
658
											$am_or_pm = 'am';
659
										};
660
										if($the_end_hour < 10) {
661
											$the_end_hour = ltrim($the_end_hour, '0');
662
										};
663
										?>
664

    
665
										<?php echo $the_start_hour; ?>:<?php the_field('start_minute'); ?><?php echo $am_or_pm; ?>&ndash;<?php echo $the_end_hour; ?>:<?php the_field('end_minute'); ?><?php echo $am_or_pm; ?>
666
									</li>
667
								<?php endforeach; ?>
668
								<?php wp_reset_postdata(); ?>
669
								</ul>
670
							<?php endif; ?>
671
							<?php if( $panels ): ?>
672
								<h2>Panels</h2>
673
								<ul>
674
								<?php foreach( $panels as $post ): 
675
									setup_postdata($post); ?>
676
									<li>
677
										<a class="<?php echo get_post_type(); ?>" href="<?php the_permalink(); ?>"><?php the_title(); ?></a><br>
678
										<?php the_field('date'); ?><br>
679
										<?php
680
										$the_start_hour = get_field('start_hour');
681
										if($the_start_hour >= 12){
682
											if($the_start_hour > 12){
683
												$the_start_hour = $the_start_hour - 12;
684
											} elseif ($the_start_hour == 12){
685
												$the_start_hour = 12;
686
											};
687
											$am_or_pm = 'pm';
688
										} elseif($the_start_hour == 0){
689
											$the_start_hour = $the_start_hour + 12;
690
											$am_or_pm = 'am';
691
										} elseif($the_start_hour < 12 && $the_start_hour > 0){
692
											$am_or_pm = 'am';
693
										};
694
										if($the_start_hour < 10) {
695
											$the_start_hour = ltrim($the_start_hour, '0');
696
										};
697
										?>
698

    
699
										<?php
700
										$the_end_hour = get_field('end_hour');
701
										if($the_end_hour >= 12){
702
											if($the_end_hour > 12){
703
												$the_end_hour = $the_end_hour - 12;
704
											} elseif ($the_end_hour == 12){
705
												$the_end_hour = 12;
706
											};
707
											$am_or_pm = 'pm';
708
										} elseif($the_end_hour == 0){
709
											$the_end_hour = $the_end_hour + 12;
710
											$am_or_pm = 'am';
711
										} elseif($the_end_hour < 12 && $the_end_hour > 0){
712
											$am_or_pm = 'am';
713
										};
714
										if($the_end_hour < 10) {
715
											$the_end_hour = ltrim($the_end_hour, '0');
716
										};
717
										?>
718

    
719
										<?php echo $the_start_hour; ?>:<?php the_field('start_minute'); ?><?php echo $am_or_pm; ?>&ndash;<?php echo $the_end_hour; ?>:<?php the_field('end_minute'); ?><?php echo $am_or_pm; ?>
720
									</li>
721
								<?php endforeach; ?>
722
								<?php wp_reset_postdata(); ?>
723
								</ul>
724
							<?php endif; ?>
725
							<?php if( $exhibitions ): ?>
726
								<h2>Exhibitions</h2>
727
								<ul>
728
								<?php foreach( $exhibitions as $post ): 
729
									setup_postdata($post); ?>
730
									<li>
731
										<a class="<?php echo get_post_type(); ?>" href="<?php the_permalink(); ?>"><?php the_title(); ?></a><br>
732
										<?php the_field('date'); ?><br>
733
										<?php
734
										$the_start_hour = get_field('start_hour');
735
										if($the_start_hour >= 12){
736
											if($the_start_hour > 12){
737
												$the_start_hour = $the_start_hour - 12;
738
											} elseif ($the_start_hour == 12){
739
												$the_start_hour = 12;
740
											};
741
											$am_or_pm = 'pm';
742
										} elseif($the_start_hour == 0){
743
											$the_start_hour = $the_start_hour + 12;
744
											$am_or_pm = 'am';
745
										} elseif($the_start_hour < 12 && $the_start_hour > 0){
746
											$am_or_pm = 'am';
747
										};
748
										if($the_start_hour < 10) {
749
											$the_start_hour = ltrim($the_start_hour, '0');
750
										};
751
										?>
752

    
753
										<?php
754
										$the_end_hour = get_field('end_hour');
755
										if($the_end_hour >= 12){
756
											if($the_end_hour > 12){
757
												$the_end_hour = $the_end_hour - 12;
758
											} elseif ($the_end_hour == 12){
759
												$the_end_hour = 12;
760
											};
761
											$am_or_pm = 'pm';
762
										} elseif($the_end_hour == 0){
763
											$the_end_hour = $the_end_hour + 12;
764
											$am_or_pm = 'am';
765
										} elseif($the_end_hour < 12 && $the_end_hour > 0){
766
											$am_or_pm = 'am';
767
										};
768
										if($the_end_hour < 10) {
769
											$the_end_hour = ltrim($the_end_hour, '0');
770
										};
771
										?>
772

    
773
										<?php echo $the_start_hour; ?>:<?php the_field('start_minute'); ?><?php echo $am_or_pm; ?>&ndash;<?php echo $the_end_hour; ?>:<?php the_field('end_minute'); ?><?php echo $am_or_pm; ?>
774
									</li>
775
								<?php endforeach; ?>
776
								<?php wp_reset_postdata(); ?>
777
								</ul>
778
							<?php endif; ?>
779
						</div>
780
					</div>
781
				<?php }; ?>
782

    
783
				<div id="sidebar">
784
					<?php the_field('sidebar_intro','options'); ?>
785
					<?php if(is_page(array(
786
						'schedule', 'performances', 'panels', 'exhibitions'
787
					))){
788
					} else { ?>
789
						<?php $events = get_posts(array(
790
							'post_type' => array('performance', 'panel', 'exhibition'),
791
							'posts_per_page' => -1,
792
							'meta_query' => array(
793
								'date_clause' => array(
794
									'key' => 'date',
795
									'compare' => 'EXISTS'
796
								),
797
								'hour_clause' => array(
798
									'key' => 'start_hour',
799
									'compare' => 'EXISTS'
800
								),
801
								'minute_clause' => array(
802
									'key' => 'start_minute',
803
									'compare' => 'EXISTS'
804
								)
805
						        
806
						    ),
807
						    'orderby' => array(
808
						    	'date_clause' => 'ASC',
809
						    	'hour_clause' => 'ASC',
810
						    	'minute_clause' => 'ASC',
811
						    )			
812
						)); ?>
813
						<?php if( $events): ?>
814
							<div class="event_list">
815
							<?php foreach( $events as $post ):
816
								setup_postdata($post); ?>
817
								<div class="single_event">
818

    
819
									<div class="right_event_col">
820
										<a href="<?php the_permalink(); ?>" class="<?php echo get_post_type();?>"><?php the_title(); ?></a>
821
										<div class="date_and_time">
822
											<?php the_field('date'); ?>
823
										</div>
824
									</div>
825
								</div>
826
							<?php endforeach; ?>
827
							<?php wp_reset_postdata(); ?>
828

    
829

    
830

    
831
							<?php $closing_party = get_page_by_path('schedule/closing-party', OBJECT, 'page');
832
							$closing_id = $closing_party->ID;
833
							if($closing_id){ ?>
834

    
835
								<div class="single_event">
836

    
837
									<div class="right_event_col">
838
										<a href="<?php echo get_the_permalink($closing_party->ID); ?>"><?php echo get_the_title($closing_party->ID); ?></a>
839
										<div class="date_and_time">
840
											<?php the_field('date', $closing_id); ?>
841
										</div>
842
									</div>
843
								</div>
844
							<?php }; ?>
845
							</div>
846
						<?php endif; ?>	
847
					<?php }; ?>
848
				</div>
849
			</div>
850
		</div>
851
		<div id="footer">
852
			<div class="footer_content">
853
				<?php the_field('footer','options'); ?>
854
			</div>
855
		</div>
856
	<?php }; ?>
857
	<style type="text/css">
858

    
859
	.acf-map {
860
		width: 100%;
861
		height: 400px;
862
		border: #ccc solid 1px;
863
		margin: 20px 0;
864
	}
865

    
866
	</style>
867
	<script src="https://maps.googleapis.com/maps/api/js?v=3.exp&sensor=false"></script>
868
	<script type="text/javascript">
869
	(function($) {
870

    
871
	/*
872
	*  render_map
873
	*
874
	*  This function will render a Google Map onto the selected jQuery element
875
	*
876
	*  @type	function
877
	*  @date	8/11/2013
878
	*  @since	4.3.0
879
	*
880
	*  @param	$el (jQuery element)
881
	*  @return	n/a
882
	*/
883

    
884
	function render_map( $el ) {
885

    
886
		// var
887
		var $markers = $el.find('.marker');
888

    
889
		// vars
890
		var args = {
891
			zoom		: 16,
892
			center		: new google.maps.LatLng(0, 0),
893
			mapTypeId	: google.maps.MapTypeId.ROADMAP
894
		};
895

    
896
		// create map	        	
897
		var map = new google.maps.Map( $el[0], args);
898

    
899
		// add a markers reference
900
		map.markers = [];
901

    
902
		// add markers
903
		$markers.each(function(){
904

    
905
	    	add_marker( $(this), map );
906

    
907
		});
908

    
909
		// center map
910
		center_map( map );
911

    
912
	}
913

    
914
	/*
915
	*  add_marker
916
	*
917
	*  This function will add a marker to the selected Google Map
918
	*
919
	*  @type	function
920
	*  @date	8/11/2013
921
	*  @since	4.3.0
922
	*
923
	*  @param	$marker (jQuery element)
924
	*  @param	map (Google Map object)
925
	*  @return	n/a
926
	*/
927

    
928
	function add_marker( $marker, map ) {
929

    
930
		// var
931
		var latlng = new google.maps.LatLng( $marker.attr('data-lat'), $marker.attr('data-lng') );
932

    
933
		// create marker
934
		var marker = new google.maps.Marker({
935
			position	: latlng,
936
			map			: map
937
		});
938

    
939
		// add to array
940
		map.markers.push( marker );
941

    
942
		// if marker contains HTML, add it to an infoWindow
943
		if( $marker.html() )
944
		{
945
			// create info window
946
			var infowindow = new google.maps.InfoWindow({
947
				content		: $marker.html()
948
			});
949

    
950
			// show info window when marker is clicked
951
			google.maps.event.addListener(marker, 'click', function() {
952

    
953
				infowindow.open( map, marker );
954

    
955
			});
956
		}
957

    
958
	}
959

    
960
	/*
961
	*  center_map
962
	*
963
	*  This function will center the map, showing all markers attached to this map
964
	*
965
	*  @type	function
966
	*  @date	8/11/2013
967
	*  @since	4.3.0
968
	*
969
	*  @param	map (Google Map object)
970
	*  @return	n/a
971
	*/
972

    
973
	function center_map( map ) {
974

    
975
		// vars
976
		var bounds = new google.maps.LatLngBounds();
977

    
978
		// loop through all markers and create bounds
979
		$.each( map.markers, function( i, marker ){
980

    
981
			var latlng = new google.maps.LatLng( marker.position.lat(), marker.position.lng() );
982

    
983
			bounds.extend( latlng );
984

    
985
		});
986

    
987
		// only 1 marker?
988
		if( map.markers.length == 1 )
989
		{
990
			// set center of map
991
		    map.setCenter( bounds.getCenter() );
992
		    map.setZoom( 16 );
993
		}
994
		else
995
		{
996
			// fit to bounds
997
			map.fitBounds( bounds );
998
		}
999

    
1000
	}
1001

    
1002
	/*
1003
	*  document ready
1004
	*
1005
	*  This function will render each map when the document is ready (page has loaded)
1006
	*
1007
	*  @type	function
1008
	*  @date	8/11/2013
1009
	*  @since	5.0.0
1010
	*
1011
	*  @param	n/a
1012
	*  @return	n/a
1013
	*/
1014

    
1015
	$(document).ready(function(){
1016

    
1017
		$('.acf-map').each(function(){
1018

    
1019
			render_map( $(this) );
1020

    
1021
		});
1022

    
1023
	});
1024

    
1025
	})(jQuery);
1026
	</script>
1027
</body>
1028
</html>
(2-2/3)