-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsingle-project.php
More file actions
289 lines (215 loc) · 13.5 KB
/
single-project.php
File metadata and controls
289 lines (215 loc) · 13.5 KB
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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
<?php
/**
* Single Post template
*/
global $post;
$alt_title = get_field( 'project_alt_title' );
$subtitle = get_field( 'project_subtitle' );
$begin_date = get_field( 'project_begin_date' );
$end_date = get_field( 'project_end_date' );
$date_string = array();
if ( $begin_date ) $date_string[] = date( 'Y', $begin_date );
$date_string[] = ( $end_date ) ? date( 'Y', $end_date ) : 'Present';
get_header(); ?>
<div class="site-content">
<?php while ( have_posts() ) : the_post(); ?>
<article <?php post_class('wrap'); ?>>
<section class="section">
<div class="flex has-sidebar u-container">
<?php get_template_part( 'partials/menu-ui' ); ?>
<div class="sidebar-masthead section__sidebar flex__item">
<?php get_template_part( 'partials/masthead' ); ?>
</div>
<div class="section__content flex__item">
<div class="page-header">
<?php if ( has_post_thumbnail() ) : ?>
<div class="post-image">
<?php the_post_thumbnail('large'); ?>
</div>
<?php endif; ?>
<h1 class="post-title <?php echo ( has_post_thumbnail() ) ? 'u-mt-3' : 'u-mt-pull'; ?>">
<?php
if ( $alt_title ) {
echo apply_filters( 'the_title', $alt_title );
} else {
the_title();
} ?>
</h1>
<?php if ( $subtitle || $begin_date || $end_date ) : ?>
<p class="h6">
<?php echo $subtitle ? '<span class="u-pr-1">'.$subtitle.'</span>' : ''; ?>
<span><?php echo implode( '–', $date_string ); ?></span>
</p>
<?php endif; ?>
</div>
</div>
</div>
</section>
<section class="section">
<div id="page-map"></div>
<script type="text/json" id="map-geojson">
<?php
$project_geojson_file = get_field('project_geojson_file');
if ( $project_geojson_file ) {
echo file_get_contents( $project_geojson_file['url'] );
} else {
echo get_field('project_geojson');
}
?>
</script>
</section>
<section class="section">
<div class="flex has-sidebar u-container">
<div class="sidebar-masthead section__sidebar flex__item u-pt-6">
</div>
<div class="section__content flex__item u-pt-6">
<div class="clearfix">
<div class="project-content post-content">
<div class="h6 u-mt-0">Description</div>
<?php the_content(); ?>
</div>
<div class="project-sidebar">
<?php get_sidebar( 'project' ); ?>
</div>
</div>
</div>
</div><!-- .u-container -->
</section>
<?php if ( have_rows('timeline_items') ) : ?>
<!--Related Events-->
<section class="section">
<div class="flex u-container">
<div class="section__content flex__item u-width-12">
<!--Vue JS App-->
<div id="project-timeline" class="vue-js-app u-clearfix u-mt-6" :class="appClass">
<div class="h5"><?php _e( 'Project Timeline', 'hsc' ); ?></div>
<div v-if="loading" class="h6 u-mt-3 u-animate-pulse">Loading...</div>
<div v-if=" ! visibleTimelineItems.length && ! loading" class="error u-mt-3">
<h3 class="u-mt-0">Sorry, no projects were found.</h3>
</div>
<div class="project-timeline__contents u-mt-6">
<div class="project-timeline__nodes">
<article :id="item.id" v-for="item in visibleTimelineItems" :key="item.id" class="timeline-node">
<aside class="timeline-node__aside">
<p class="timeline-node__aside-traveller h6 u-mt-0 u-mb-1">
<span v-html="item.label"></span><br/>
<span style="opacity:0.5">
{{ item.date_string }}
</span>
</p>
</aside>
<div class="timeline-node__main">
<!-- LAYOUT: Project Stage -->
<div v-if="item.layout == 'project_stage'" class="layout-project-stage u-clearfix" v-html="item.content"></div>
<!-- LAYOUT: Publication -->
<div v-if="item.type == 'publication'" class="layout-publication u-clearfix">
<h3 class="h4 u-mt-0">{{ item.title }}</h3>
<p v-html="item.image"></p>
<p><a :href="link.url" class="u-mr-1 u-color-black u-color-hover-green" v-for="link in item.links" v-html="link.text"></a></p>
</div>
<!-- LAYOUT: Event -->
<div v-if="item.type == 'event'" class="layout-event u-clearfix">
<a :href="item.permalink" class="u-display-block u-color-hover-green">
<div class="image" v-html="item.image"></div>
<div class="content">
<h3 class="title h1">{{ item.title }}</h3>
<p class="h6 u-mt-nudge">
{{ item.date_string }}, {{ item.time_string }}<br/>
{{ item.venue }}
</p>
<p><?php _e( 'Read more', 'hsc' ); echo ' →' ?></p>
</div>
</a>
</div>
<!-- LAYOUT: Events Recap -->
<div v-if="item.type == 'events_recap'" class="layout-events-recap">
<ul class="u-mt-0" v-if="item.events.length">
<li v-for="event in item.events" class="u-mb-1">
<a :href="event.permalink" class="u-display-block u-clearfix u-color-hover-green ">
<div class="image" v-html="event.image"></div>
<div class="content">
<p class="h5 u-mt-0">
{{event.post_title}}<br/>
{{event.date_string}}
</p>
</div>
</a>
</li>
</ul>
<h3 class="h1 u-mt-0">{{ item.title }}</h3>
<div v-html="item.desc"></div>
</div>
</div>
</article>
</div><!-- .project-timeline__nodes -->
</div><!-- project-timeline__contents -->
</div><!-- #project-timeline -->
</div>
</div><!-- .u-container -->
</section>
<?php endif; ?>
<?php
// Related Publications
$args = array(
'post_type' => 'publication',
'posts_per_page' => 10,
'meta_query' => array(
array(
'key' => 'publication_related_projects',
'value' => strval($post->ID),
'compare' => 'LIKE'
)
)
);
$publications = new WP_Query( $args ); ?>
<?php if ( $publications->have_posts() ) : ?>
<section class="section">
<div class="flex u-container">
<div class="section__content flex__item u-width-12 u-pt-6">
<div class="h6 u-mt-0"><?php _e( 'Related Publications', 'hsc' ); ?></div>
<ul class="u-clearfix u-mt-0">
<?php while( $publications->have_posts() ) : $publications->the_post(); ?>
<li class="u-span-6 u-mt-1">
<?php get_template_part( 'partials/content-preview', 'publication' ); ?>
</li>
<?php endwhile; ?>
</ul>
</div>
</div><!-- .u-container -->
</section>
<?php endif; ?>
<?php
// Related Projects
$args = array(
'post_type' => 'project',
'posts_per_page' => 2,
'post__not_in' => array( $post->ID )
);
$related_project_ids = get_field('project_related_projects');
$projects_title = __( 'Recent Projects', 'hsc');
if ( ! empty( $related_project_ids ) ) {
$args['post__in'] = $related_project_ids;
$projects_title = __( 'Related Projects', 'hsc');
}
$projects = new WP_Query( $args ); ?>
<?php if ( $projects->have_posts() ) : ?>
<section class="section">
<div class="flex u-container">
<div class="section__content flex__item u-width-12 u-pt-6">
<div class="h6 u-mt-0"><?php echo $projects_title; ?></div>
<ul class="u-clearfix">
<?php while( $projects->have_posts() ) : $projects->the_post(); ?>
<li class="u-span-6">
<?php get_template_part( 'partials/content-preview', 'project' ); ?>
</li>
<?php endwhile; wp_reset_query(); ?>
</ul>
</div>
</div><!-- .u-container -->
</section>
<?php endif; ?>
</article>
<?php endwhile; ?>
</div>
<?php get_footer(); ?>