Project

General

Profile

Support #10333 » front-page.php

Moeinedin Shashaei, 2018-09-17 12:43 AM

 
1
<!DOCTYPE html>
2
<html xmlns="http://www.w3.org/1999/xhtml" style="margin-top: 0 !important;">
3
<head>
4
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
5
	<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
6
	<link rel="icon" type="image/x-icon" href="<?php echo get_template_directory_uri(); ?>/images/favicon.png">
7
	<title><?php wp_title( '|', true, 'right' ); ?> <?php bloginfo('name'); ?></title>
8
	<?php wp_head(); ?>
9
</head>
10
<body style="background-image: url('<?php echo get_template_directory_uri(); ?>/images/background.png');">
11
<div class="overflow">
12
	<?php
13
	$festival_dates = get_posts(array(
14
		'post_type' => 'festival_dates',
15
		'post_per_page' => -1,
16
		'meta_key' => 'date',
17
		'orderby' => 'meta_value_num',
18
		'order' => 'ASC',
19
	));
20
	$number_of_days = count($festival_dates);
21
	$half_hour_y = 99.75;
22
	$first_hour_y = 208;
23
	$d_1_y = 23;
24
	$d = 1;
25
	foreach ($festival_dates as $post) {
26
		setup_postdata( $post );
27

    
28
		${'start_time_' . $d} = new DateTime(get_field('start_time'));
29
		${'end_time_' . $d} = new DateTime(get_field('end_time'));
30
		${'d_' . $d} = ${'start_time_' . $d}->format('Y-m-d');
31
		$diff = ${'end_time_' . $d}->diff(${'start_time_' . $d});
32
		${'half_hours_' . $d} = (($diff->h)-1)*2;
33
		$y = $d;
34
		$d++;
35
		${'d_' . $d . '_y'} = (${'d_' . $y . '_y'} + 185) + (${'half_hours_' . $y}*99.75) + 212;
36
	}
37
	wp_reset_postdata();
38
	?>
39
	<div id="wrapper" class="home_page">
40
		<div id="header">
41
			<div class="fixed_header">
42
				<h1 class="fest_title"><?php the_field('festival_title','options'); ?></h1><h1 class="year"><?php the_field('festival_year','options'); ?></h1>
43
				<div class="sub_heads">
44
					<h2><?php the_field('festival_subtitle','options'); ?></h2>
45
					<h3><?php the_field('festival_dates','options'); ?></h3>
46
					<div class="line"></div><div class="angled_line"></div>
47
				</div>
48
				<br clear="all">
49
			</div>
50
			<div class="mast_head">
51
				<h1 class="fest_title"><?php the_field('festival_title','options'); ?></h1><h1 class="year"><?php the_field('festival_year','options'); ?></h1>
52
				<div class="sub_heads">
53
					<h2><?php the_field('festival_subtitle','options'); ?></h2>
54
					<h3><?php the_field('festival_dates','options'); ?></h3>
55
					<div class="line"></div><div class="angled_line"></div>
56
				</div>
57
				<br clear="all">
58
			</div>
59
			<div class="nav">
60
				<div class="instructions"><?php the_field('header_text','options'); ?></div>
61
				<div class="nav_items">
62
					<?php wp_nav_menu(); ?>
63
				</div>
64
			</div>
65
			<div class="promo" timer="<?php the_field('promo_timer','options'); ?>">
66
				<?php
67
				$promos = get_field('promo_events','options');
68
				if($promos){
69
					$p = 1;
70
					foreach ($promos as $post) {
71
						setup_postdata($posts); ?>
72

    
73
						<?php $image = get_field('featured_image');
74
						if($image){
75
							$size = 'large';
76
							$large = $image['sizes'][$size];
77
						} ?>
78

    
79
						<?php
80
						// EVENT TIME AND DATE //
81
						$start_time = new DateTime(get_field('start_time'));
82
						$end_time = new DateTime(get_field('end_time'));
83
						$start_date = $start_time->format('Y-m-d');
84
						$display_date = $start_time->format('M j');
85
						$display_start_time_hour = $start_time->format('g');
86
						$display_start_time_min = $start_time->format(':i');
87
						$display_start_time_ampm = $start_time->format('a');
88
						$display_end_time_hour = $end_time->format('g');
89
						$display_end_time_min = $end_time->format(':i');
90
						$display_end_time_ampm = $end_time->format('a');
91
						if($display_start_time_min == ':00'){
92
							$display_start_time_min = '';
93
						}
94
						if($display_end_time_min == ':00'){
95
							$display_end_time_min = '';
96
						}
97
						if($display_start_time_ampm == $display_end_time_ampm){
98
							$display_start_time_ampm = '';
99
						}
100
						$display_time = $display_start_time_hour . $display_start_time_min . $display_start_time_ampm . '&ndash;' . $display_end_time_hour . $display_end_time_min . $display_end_time_ampm;
101
						?>
102

    
103
						<?php 
104
						// SET UP TITLE FOR PROMO //
105
						$ex_title = '';
106
						$long_description = get_field('long_description');
107
						if(have_rows('presentations')){
108
							while(have_rows('presentations')){
109
								the_row();
110
								$artists = get_sub_field('artist');
111
								foreach ($artists as $artist) {
112
									$artist_name = get_the_title($artist->ID);
113
								}
114
								if($long_description){
115
									$ex_title .= '<h2><a href="' . get_the_permalink() . '">' . get_sub_field('presentation_title') . '</a></h2><h3><a href="' . get_the_permalink() . '">' . $artist_name . '</a></h3>';
116
								} else {
117
									$ex_title .= '<h2>' . get_sub_field('presentation_title') . '</h2><h3>' . $artist_name . '</h3>';
118
								}
119
							}
120
						} ?>
121

    
122
						<?php if($p == 1){ ?>
123
							<div class="single_promo active" style="background-image:url('<?php echo $large; ?>');">
124
						<?php } else { ?>
125
							<div class="single_promo" style="background-image:url('<?php echo $large; ?>');">
126
						<?php } ?>
127
							<div class="promo_title">
128
								<?php echo $ex_title; ?>
129
							</div>
130
							<div class="promo_date">
131
								<?php echo $display_time; ?> / <?php echo $display_date; ?>
132
							</div>
133
							<div class="background_gradient"></div>
134
							<div class="promo_link"><a href="<?php the_permalink(); ?>"></a></div>
135

    
136
						</div>
137

    
138
						<?php $p++; ?>
139

    
140
					<?php } ?>
141
					<?php wp_reset_postdata(); ?>
142
				<?php } ?>
143
			</div>
144
		</div>
145
		<div id="venues">
146
			<?php 
147
			$left_venue = get_field('left_venue','options');
148
			$left_venue_arr = array();
149
			if($left_venue){
150
				foreach ($left_venue as $lv) {
151
					$left_venue_name = get_the_title($lv->ID);
152
					array_push($left_venue_arr, $lv->ID);
153
					$left_venue_display = get_field('display_venue_as', $lv->ID);
154
				}
155
			}
156
			$center_venue_left = get_field('center_venue_left', 'options');
157
			$center_venue_left_arr = array();
158
			if($center_venue_left){
159
				foreach ($center_venue_left as $cvl) {
160
					$center_venue_left_name = get_the_title($cvl->ID);
161
					array_push($center_venue_left_arr, $cvl->ID);
162
					//$center_venue_left_display = get_field('display_venue_as', $cvl->ID);
163
				}
164
			}
165
			$center_venue_right = get_field('center_venue_right', 'options');
166
			$center_venue_right_arr = array();
167
			if($center_venue_right){
168
				foreach ($center_venue_right as $cvr) {
169
					$center_venue_right_name = get_the_title($cvr->ID);
170
					array_push($center_venue_right_arr, $cvr->ID);
171
					//$center_venue_right_display = get_field('display_venue_as', $cvr->ID);
172
				}
173
			}
174
			$right_venue = get_field('right_venue','options');
175
			$right_venue_arr = array();
176
			if($right_venue){
177
				foreach ($right_venue as $rv) {
178
					$right_venue_name = get_the_title($rv->ID);
179
					array_push($right_venue_arr, $rv->ID);
180
					$right_venue_display = get_field('display_venue_as', $rv->ID);
181
				}
182
			}
183
			?>
184
			<!--<div class="single_venue left_venue">
185
				<?php if($left_venue){ ?>
186
					<h3>
187
						<?php echo $left_venue_display; ?>
188
					</h3>
189
				<?php } ?>
190
			</div>
191
			<div class="single_venue right_venue">
192
				<?php if($right_venue){ ?>
193
					<h3>
194
						<?php echo $right_venue_display; ?>
195
					</h3>
196
				<?php } ?>
197
			</div>
198
			<br clear="all">-->
199
		</div>
200
		<div id="schedule">
201

    
202
			<?php
203

    
204
			$events = get_posts(array(
205
				'post_type' => 'events',
206
				'post_per_page' => -1,
207
				'nopaging' => true,
208
				'meta_key' => 'start_time',
209
				'orderby' => 'meta_value_num',
210
				'order' => 'ASC',
211
			));
212
			if($events) {
213
				foreach ($events as $post) {
214
					setup_postdata( $post ); ?>
215

    
216
					<?php 
217
					// SET UP TITLE FOR SCHEDULE //
218
					$title = '';
219
					$ex_title = '';
220
					$long_description = get_field('long_description');
221
					if(have_rows('presentations')){
222
						while(have_rows('presentations')){
223
							the_row();
224
							$artists = get_sub_field('artist');
225
							foreach ($artists as $artist) {
226
								$artist_name = get_the_title($artist->ID);
227
							}
228
							$title .= '<h2 class="open">' . get_sub_field('presentation_title') . '</h2><h3 class="open">' . $artist_name . '</h3>';
229
							if($long_description){
230
								$ex_title .= '<h2 class="open"><a href="' . get_the_permalink() . '">' . get_sub_field('presentation_title') . '</a></h2><h3 class="open">' . $artist_name . '</h3>';
231
							} else {
232
								$ex_title .= '<h2 class="open">' . get_sub_field('presentation_title') . '</h2><h3 class="open">' . $artist_name . '</h3>';
233
							}
234
						}
235
					} ?>
236

    
237
					<?php
238
					// SET UP EVENT HEIGHT //
239
					$start_time = new DateTime(get_field('start_time'));
240
					$end_time = new DateTime(get_field('end_time'));
241
					$diff = $end_time->diff($start_time);
242
					$minutes = $diff->days * 24 * 60;
243
					$minutes += $diff->h * 60;
244
					$minutes += $diff->i;
245
					$half_hours = $minutes / 30;
246
					$event_height = 'height_' . $half_hours;
247
					$start_date = $start_time->format('Y-m-d');
248
					$display_date = $start_time->format('M j');
249
					$display_start_time_hour = $start_time->format('g');
250
					$display_start_time_min = $start_time->format(':i');
251
					$display_start_time_ampm = $start_time->format('a');
252
					$display_end_time_hour = $end_time->format('g');
253
					$display_end_time_min = $end_time->format(':i');
254
					$display_end_time_ampm = $end_time->format('a');
255
					if($display_start_time_min == ':00'){
256
						$display_start_time_min = '';
257
					}
258
					if($display_end_time_min == ':00'){
259
						$display_end_time_min = '';
260
					}
261
					if($display_start_time_ampm == $display_end_time_ampm){
262
						$display_start_time_ampm = '';
263
					}
264
					$display_time = $display_start_time_hour . $display_start_time_min . $display_start_time_ampm . '&ndash;' . $display_end_time_hour . $display_end_time_min . $display_end_time_ampm;
265
					$s = 1;
266
					foreach ($festival_dates as $festival_date) {
267
						if($start_date == ${'d_' . $s}){
268
							$day = $s;
269
							$day_y = ${'d_' . $s . '_y'};
270
							$first_time = ${'start_time_' . $s};
271
						}
272
						$s++;
273
					}
274
					$first_hour = $first_time->format('Hi');
275
					$event_time = $start_time->format('Hi');
276
					$difference = $start_time->diff($first_time);
277
					$mins = $difference->days * 24 * 60;
278
					$mins += $difference->h * 60;
279
					$mins += $difference->i;
280
					$halfs = $mins / 30;
281
					$offset = $halfs * $half_hour_y + $day_y + 185;
282
					$too_high_point = $d_1_y + 185;
283
					if($offset <= $too_high_point){
284
						$too_high_class = ' too_high';
285
					} else {
286
						$too_high_class = '';
287
					}
288
					?>
289

    
290
					<?php
291
					// EVENT LABEL //
292
					$label = get_the_category();
293
					?>
294

    
295
					<?php
296
					// EVENT IMAGE //
297
					$image = get_field('featured_image');
298
					if($image){
299
						$size = 'large';
300
						$large = $image['sizes'][$size];
301
					}
302
					?>
303

    
304
					<?php
305
					// SET UP VENUE AND PLACEMENT OF EVENT //
306
					$venue = get_field('venue');
307
					foreach ($venue as $v) {
308
						$venue_name = get_the_title($v->ID);
309
						$venue_display = get_field('display_venue_as', $v->ID);
310
						$venue_ID = $v->ID;
311
					}
312
					if(in_array($venue_ID, $left_venue_arr)){ ?>
313
						<div class="left_schedule<?php echo $too_high_class; ?>" style="top: <?php echo $offset; ?>px;">
314
							<div class="single_event <?php echo $event_height; ?>">
315
								<div class="event_label open">
316
									<?php echo $label[0]->cat_name; ?>
317
								</div>
318
								<div class="workshop_locale open">
319
									<?php echo $venue_display; ?>
320
								</div>
321
								<div class="event_details">
322
									<div class="event_details_wrapper">
323
										<?php echo $title; ?>
324
									</div>
325
									<div class="background_gradient open"></div>
326
									<?php if($image){ ?><div class="background_image open" style="background-image:url('<?php echo $large; ?>');"></div><?php } ?>
327
								</div>
328
								<div class="connector"></div>
329
							</div>
330
							<div class="expanded_event">
331
								<div class="expanded_top">
332
									<div class="close">
333
										X Close
334
									</div>
335
									<?php if($image){ ?>
336
										<div class="event_image">
337
											<?php if($long_description){ ?>
338
												<a href="<?php the_permalink(); ?>"><img src="<?php echo $large; ?>"></a>
339
											<?php } else { ?>
340
												<img src="<?php echo $large; ?>">
341
											<?php } ?>
342
										</div>
343
									<?php } ?>
344
								</div>
345
								<div class="event_label">
346
									<?php echo $label[0]->cat_name; ?>
347
								</div>
348
								<div class="the_event">
349
									<div class="event_details">
350
										<div class="event_details_wrapper">
351
											<h4><?php echo $display_time; ?> / <?php echo $display_date; ?> / <?php echo $venue_display; ?></h4>
352
											<?php echo $ex_title; ?>
353
											<div class="event_content">
354
												<?php the_field('short_description'); ?>
355
												<?php if($long_description){ ?>
356
													<p><strong><a href="<?php the_permalink(); ?>">READ MORE</a></strong></p>
357
												<?php } ?>
358
											</div>
359
										</div>
360
									</div>
361
									<div class="connector"></div>
362
								</div>
363
							</div>
364
						</div>
365
					<?php } elseif(in_array($venue_ID, $right_venue_arr)){ ?>
366
						<div class="right_schedule<?php echo $too_high_class; ?>" style="top: <?php echo $offset; ?>px">
367
							<div class="single_event <?php echo $event_height; ?>">
368
								<div class="event_label open">
369
									<?php echo $label[0]->cat_name; ?>
370
								</div>
371
								<div class="workshop_locale open">
372
									<?php echo $venue_display; ?>
373
								</div>
374
								<div class="event_details">
375
									<div class="event_details_wrapper">
376
										<?php echo $title; ?>
377
									</div>
378
									<div class="background_gradient open"></div>
379
									<?php if($image){ ?><div class="background_image open" style="background-image:url('<?php echo $large; ?>');"></div><?php } ?>
380
								</div>
381
								<div class="connector"></div>
382
							</div>
383
							<div class="expanded_event">
384
								<div class="expanded_top">
385
									<div class="close">
386
										X Close
387
									</div>
388
									<?php if($image){ ?>
389
										<div class="event_image">
390
											<?php if($long_description){ ?>
391
												<a href="<?php the_permalink(); ?>"><img src="<?php echo $large; ?>"></a>
392
											<?php } else { ?>
393
												<img src="<?php echo $large; ?>">
394
											<?php } ?>
395
										</div>
396
									<?php } ?>
397
								</div>
398
								<div class="event_label">
399
									<?php echo $label[0]->cat_name; ?>
400
								</div>
401
								<div class="the_event">
402
									<div class="event_details">
403
										<div class="event_details_wrapper">
404
											<h4><?php echo $display_time; ?> / <?php echo $display_date; ?> / <?php echo $venue_display; ?></h4>
405
											<?php echo $ex_title; ?>
406
											<div class="event_content">
407
												<?php the_field('short_description'); ?>
408
												<?php if($long_description){ ?>
409
													<p><strong><a href="<?php the_permalink(); ?>">READ MORE</a></strong></p>
410
												<?php } ?>
411
											</div>
412
										</div>
413
									</div>
414
								</div>
415
								<div class="connector"></div>
416
							</div>
417
						</div>
418
					<?php } elseif(in_array($venue_ID, $center_venue_left_arr)){ ?>
419
						<div class="center left_schedule<?php echo $too_high_class; ?>" style="top: <?php echo $offset; ?>px">
420
							<div class="single_event <?php echo $event_height; ?>">
421
								<div class="event_label open">
422
									<?php echo $label[0]->cat_name; ?>
423
								</div>
424
								<div class="workshop_locale open">
425
									<?php echo $venue_display; ?>
426
								</div>
427
								<div class="event_details">
428
									<div class="event_details_wrapper">
429
										<?php echo $title; ?>
430
									</div>
431
									<div class="background_gradient open"></div>
432
									<?php if($image){ ?><div class="background_image open" style="background-image:url('<?php echo $large; ?>');"></div><?php } ?>
433
								</div>
434
							</div>
435
							<div class="expanded_event">
436
								<div class="expanded_top">
437
									<div class="close">
438
										X Close
439
									</div>
440
									<?php if($image){ ?>
441
										<div class="event_image">
442
											<?php if($long_description){ ?>
443
												<a href="<?php the_permalink(); ?>"><img src="<?php echo $large; ?>"></a>
444
											<?php } else { ?>
445
												<img src="<?php echo $large; ?>">
446
											<?php } ?>
447
										</div>
448
									<?php } ?>
449
								</div>
450
								<div class="event_label">
451
									<?php echo $label[0]->cat_name; ?>
452
								</div>
453
								<div class="the_event">
454
									<div class="event_details">
455
										<div class="event_details_wrapper">
456
											<h4><?php echo $display_time; ?> / <?php echo $display_date; ?> / <?php echo $venue_display; ?></h4>
457
											<?php echo $ex_title; ?>
458
											<div class="event_content">
459
												<?php the_field('short_description'); ?>
460
												<?php if($long_description){ ?>
461
													<p><strong><a href="<?php the_permalink(); ?>">READ MORE</a></strong></p>
462
												<?php } ?>
463
											</div>
464
										</div>
465
									</div>
466
								</div>
467
								<div class="connector"></div>
468
							</div>
469
						</div>
470
					<?php } elseif(in_array($venue_ID, $center_venue_right_arr)) { ?>
471
						<div class="center right_schedule<?php echo $too_high_class; ?>" style="top: <?php echo $offset; ?>px">
472
							<div class="single_event <?php echo $event_height; ?>">
473
								<div class="event_label open">
474
									<?php echo $label[0]->cat_name; ?>
475
								</div>
476
								<div class="workshop_locale open">
477
									<?php echo $venue_display; ?>
478
								</div>
479
								<div class="event_details">
480
									<div class="event_details_wrapper">
481
										<?php echo $title; ?>
482
									</div>
483
									<div class="background_gradient open"></div>
484
									<?php if($image){ ?><div class="background_image open" style="background-image:url('<?php echo $large; ?>');"></div><?php } ?>
485
								</div>
486
							</div>
487
							<div class="expanded_event">
488
								<div class="expanded_top">
489
									<div class="close">
490
										X Close
491
									</div>
492
									<?php if($image){ ?>
493
										<div class="event_image">
494
											<?php if($long_description){ ?>
495
												<a href="<?php the_permalink(); ?>"><img src="<?php echo $large; ?>"></a>
496
											<?php } else { ?>
497
												<img src="<?php echo $large; ?>">
498
											<?php } ?>
499
										</div>
500
									<?php } ?>
501
								</div>
502
								<div class="event_label">
503
									<?php echo $label[0]->cat_name; ?>
504
								</div>
505
								<div class="the_event">
506
									<div class="event_details">
507
										<div class="event_details_wrapper">
508
											<h4><?php echo $display_time; ?> / <?php echo $display_date; ?> / <?php echo $venue_display; ?></h4>
509
											<?php echo $ex_title; ?>
510
											<div class="event_content">
511
												<?php the_field('short_description'); ?>
512
												<?php if($long_description){ ?>
513
													<p><strong><a href="<?php the_permalink(); ?>">READ MORE</a></strong></p>
514
												<?php } ?>
515
											</div>
516
										</div>
517
									</div>
518
								</div>
519
								<div class="connector"></div>
520
							</div>
521
						</div>
522
					<?php } ?>
523
				<?php }
524
				wp_reset_postdata();
525
			}
526
			?>
527
			<div class="center_date_time">
528
				<?php
529

    
530
				$festival_dates = get_posts(array(
531
					'post_type' => 'festival_dates',
532
					'post_per_page' => -1,
533
					'meta_key' => 'date',
534
					'orderby' => 'meta_value_num',
535
					'order' => 'ASC',
536
				));
537
				if($festival_dates) {
538
					foreach ($festival_dates as $post) {
539
						setup_postdata( $post ); ?>
540
						<div class="single_center_date">
541
							<div class="center_date">
542
								<?php
543
								$date = new DateTime(get_field('date'));
544
								$date_display = $date->format('M') . ' ' . $date->format('j');
545
								echo $date_display;
546
								?>
547
							</div>
548
							<div class="center_date_line"></div>
549
							<div class="center_time">
550
								<?php
551
								$start_time = get_field('start_time');
552
								$end_time = get_field('end_time');
553
								$hours = new DatePeriod(
554
									new DateTime($start_time),
555
									new DateInterval('PT1H'),
556
									new DateTime($end_time)
557
								);
558
								foreach($hours as $hour) { ?>
559
									<div class="single_center_time <?php the_field('date'); ?><?php echo $hour->format('H'); ?>">
560
										<?php echo $hour->format('g'); ?>
561
									</div>
562
								<?php }	?>
563
							</div>
564
						</div>
565
					<?php }
566
					wp_reset_postdata();
567
				}
568
				?>
569
				<div class="sticky_date">
570
				</div>
571
				<div class="spine">
572
				</div>
573
			</div>
574
			<!--div class="the_background">
575
			</div-->
576
		</div>
577
	</div>
578
	<div class="jump_to">Jump to What's Playing Now</div>
579
	<div class="single_background" style="background-image: url('<?php echo get_template_directory_uri(); ?>/images/hamlet.png'); background-size: 20%; background-repeat: no-repeat; background-position: left bottom;"></div>
580
	<?php wp_footer(); ?>
581
</div>
582
</body>
583
</html>
    (1-1/1)