Repository navigation
Expand file tree
/
Copy pathsingle-case.php
More file actions
389 lines (305 loc) · 12.5 KB
/
Copy pathsingle-case.php
File metadata and controls
389 lines (305 loc) · 12.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
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
<?php get_header();
global $post;
$has_sidebar = 0;
$layout = 'fullpage';
// tweak Innovationstatus text title
function bs_case_innovation_status_text_field($field) {
$field['label'] = 'What is the current status of your innovation?';
return $field;
}
add_filter('acf/load_field/key=field_5ae77cd92bcf8', 'bs_case_innovation_status_text_field', 20);
?>
<div class="col-sm-<?php echo 12 - $has_sidebar; ?> <?php echo ($has_sidebar > 0 ? 'col-sm-pull-3' : ''); ?>">
<?php while ( have_posts() ) : the_post(); $postid = get_the_ID();
$userid = get_the_author_meta('ID');
$job = xprofile_get_field_data( 'Job Title', $userid);
$name = xprofile_get_field_data( 'Name', $userid);
$upload_images = get_field( 'materials_&_short_explanation_photo_and_video_upload_images' );
$upload_files = get_field( 'materials_&_short_explanation_photo_and_video_upload_supporting_files' );
$other_url = get_field( 'materials_&_short_explanation_photo_and_video_other_related_url' );
$country = wp_get_post_terms( $postid, 'country' );
$badges = wp_get_post_terms( $postid, 'innovation-badge' );
$iso = false;
if ( $country ) {
$iso = get_field( 'iso_code', $country[0] );
}
$fields = get_all_acf_fields_by_group_key( 'group_5ae729d53fd82', false );
$texts = get_textarea_acf_fields_by_group_key( 'group_5ae729d53fd82', true );
// echo '<pre>'.print_r($fields, true).'</pre>';
$textsloop = $texts;
// unset( $textsloop['personal_details'] );
// unset( $textsloop['organisation_details'] );
// unset( $textsloop['describing_the_innovation'] );
// unset( $textsloop['questionnaire_feedback_miscellaneous'] );
?>
<div class="row">
<div class="col-md-9">
<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
<?php if ( isset( $upload_images[0] ) ) { ?>
<div class="single_img_wrap <?php echo (!isset( $upload_images[0] ) ? 'noimg' : ''); ?>">
<?php
echo '
<a href="' . $upload_images[0]['sizes']['large'] . '" title="' . the_title_attribute('echo=0') . '" class="featuredimglink fancybox" >';
echo '<img src="'.$upload_images[0]['sizes']['blog'].'" alt="'.$upload_images[0]['title'].'" width="'. $upload_images[0]['sizes']['blog-width'] .'" height="'. $upload_images[0]['sizes']['blog-height'] .'"" />';
echo '</a>';
if ($upload_images[0]['caption'] != '') {
echo '<p>'. $upload_images[0]['caption'] .'</p>';
}
echo ( get_field('hide_social_sharing') === true ? '' : wpfai_social() );
?>
</div>
<?php } ?>
<?php
if ( !isset( $upload_images[0] ) ) { ?>
<div class="social_sharing_wrap pull-right">
<?php echo ( get_field('hide_social_sharing') === true ? '' : wpfai_social() ); ?>
</div>
<?php
}
?>
<?php if (get_field('hide_page_title') !== true) { ?>
<h1 class="entry-title <?php echo ( !empty( $badges ) ? 'pull-left' : ''); ?>"><?php the_title(); ?></h1>
<?php } ?>
<?php
if ( !empty( $badges ) ) {
echo '<div class="tooltips_wrap">';
foreach ( $badges as $badge ) {
$icon = get_field( 'icon', $badge );
echo '
<span class="tooltips">
<a href="'. get_term_link( $badge->slug, 'innovation-badge' ) .'" title="'. $badge->name .' '.__( 'innovations', 'opsi' ) .'" target="_blank">
<img src="'. $icon['url'] .'" width="'. $icon['width'] .'" height="'. $icon['height'] .'" alt="'. $badge->name .'" />
</a>
<span>'. $badge->name . ( $badge->description != '' ? '<br /><small>'. $badge->description : '') .'</small></span>
</span>';
}
echo '</div>';
echo '<div class="clearfix padding20"></div>';
}
?>
<div class="entry-content"><?php the_content(); ?></div>
<?php if ( $fields['describing_the_innovation']['short_and_simple_explanation'] != '' ) { ?>
<div class="csp"><?php echo $fields['describing_the_innovation']['short_and_simple_explanation']['text']; ?></div>
<?php } ?>
<?php
$ii = 0; // inner index
$oi = 0; // outter index
foreach ( $textsloop as $tareas ) {
if ( $tareas['display_order'] == -2 ) { continue; }
?>
<div class="sliding_panel <?php echo ( $oi == 0 ? 'open' : '' ); ?>">
<h2 class="<?php echo ( $oi == 0 ? 'active' : '' ); ?>"><?php echo $tareas['label']; ?></h2>
<div class="panel_content" <?php echo ( $oi == 0 ? '' : 'style="display: none;"' ); ?>>
<?php
unset( $tareas['label'] ); // remove the label and loop
foreach( $tareas as $tarea ) { ?>
<?php if ( isset( $tarea['text'] ) && $tarea['text'] != '' ) {
if ( $tarea['display_order'] == -2 ) { continue; }
?>
<?php if ( $tarea['label'] != '_removed' ) { ?>
<h3><?php echo $tarea['label']; ?></h3>
<?php } ?>
<div class="csp"><?php echo $tarea['text']; ?></div>
<?php } ?>
<?php
$ii++;
}
?>
</div>
</div>
<?php
$ii = 0;
$oi++;
}
$video1 = get_field( 'materials_&_short_explanation_photo_and_video_video_url_1' );
$video2 = get_field( 'materials_&_short_explanation_photo_and_video_video_url_2' );
$video3 = get_field( 'materials_&_short_explanation_photo_and_video_video_url_3' );
?>
<div class="video_wrap">
<?php
if ( $video1 ) { echo '<h3>'. __( 'Project Pitch', 'opsi' ) .'</h3><div class="single_vid">'.wp_oembed_get( $video1 ).'</div>'; }
if ( $video2 || $video3 ) { echo '<h3>'. __( 'Supporting Videos', 'opsi' ) .'</h3>'; }
if ( $video2 ) { echo '<div class="single_vid">'.wp_oembed_get( $video2 ).'</div>'; }
if ( $video3 ) { echo '<div class="single_vid">'.wp_oembed_get( $video3 ).'</div>'; }
?>
</div>
</article>
<?php comments_template(); ?>
</div>
<div class="col-md-3 case_study_sidebar">
<div class="cs_sidebar_wrap">
<div class="row">
<?php if ( $iso != '' ) { ?>
<div class="col-xs-4">
<a href="<?php echo get_post_type_archive_link( 'case' ); ?>?_countries=<?php echo $country[0]->slug; ?>" title="<?php echo __( 'All innovations by:', 'opsi' ); ?> <?php echo $country[0]->name; ?>" class="blacklink" target="_blank" >
<img src="<?php echo get_stylesheet_directory_uri().'/images/flags/'.$iso.'.png'; ?>" width="96" height="96" alt="<?php echo $country[0]->name; ?>" class="cs_flag" />
</a>
</div>
<?php } ?>
<?php if ( !empty( $country ) ) { ?>
<div class="col-xs-8 cs_country_name">
<h4>
<a href="<?php echo get_post_type_archive_link( 'case' ); ?>?_countries=<?php echo $country[0]->slug; ?>" title="<?php echo __( 'All innovations by:', 'opsi' ); ?> <?php echo $country[0]->name; ?>" class="blacklink" target="_blank" >
<?php echo $country[0]->name; ?>
</h4></a>
</div>
<?php } ?>
</div>
</div>
<div class="cs_sidebar_wrap">
<div class="row">
<div class="col-md-12">
<?php if ( $fields['describing_the_innovation']['year_innovation_launched'] != '' ) { ?>
<div class="year_wrap">
<span class="sidebar_label"><?php echo __( 'Year:', 'opsi' ); ?></span>
<span class="strong"><?php echo $fields['describing_the_innovation']['year_innovation_launched']['text']; ?></span>
</div>
<?php } ?>
<?php if ( $fields['describing_the_innovation']['innovation_website']['text'] != '' ) { ?>
<div class="website_wrap">
<span class="sidebar_label"><?php echo __( 'Website:', 'opsi' ); ?></span>
<span class="strong truncate">
<a href="<?php echo $fields['describing_the_innovation']['innovation_website']['text']; ?>" title="<?php echo $fields['describing_the_innovation']['name_of_innovation']['text']; ?>" target="_blank" >
<?php echo $fields['describing_the_innovation']['innovation_website']['text']; ?>
</a>
</span>
</div>
<?php } ?>
<?php if ( $other_url != '' ) { ?>
<div class="website_wrap additional">
<span class="strong truncate">
<a href="<?php echo $other_url; ?>" title="<?php echo __( 'additional URL', 'opsi' ); ?>" target="_blank" >
<?php echo $other_url; ?>
</a>
</span>
</div>
<?php } ?>
<?php if ( !empty( $fields['organisation_details']['level_of_government'] ) ) { ?>
<div class="log_wrap">
<span class="sidebar_label"><?php echo __( 'Level of government:', 'opsi' ); ?></span>
<span class="strong"><?php echo $fields['organisation_details']['level_of_government']['text']['label']; ?></span>
</div>
<?php } ?>
</div>
</div>
</div>
<?php if ( !empty( $fields['innovation_description']['innovation_status']['text'] ) ) { ?>
<div class="cs_sidebar_wrap">
<div class="row">
<div class="col-xs-12">
<h4 class="status_label"><?php echo __( 'Status:', 'opsi' ); ?></h4>
<ul class="nospace">
<?php foreach( $fields['innovation_description']['innovation_status']['text'] as $status ) { ?>
<li><span class="strong"><?php echo $status['label']; ?></span></li>
<?php } ?>
</ul>
</div>
</div>
</div>
<?php } ?>
<div class="post_tags_wrap">
<div class="post_tags">
<h4><?php echo __( 'Innovation tags:', 'opsi' ); ?></h4>
<?php echo get_the_term_list( get_the_ID(), 'innovation-tag' );
?>
<?php if ( !empty( $fields['describing_the_innovation']['custom_innovation_tags']['text'] ) ) {
$custom_tags = explode( ',', $fields['describing_the_innovation']['custom_innovation_tags']['text'] );
foreach( $custom_tags as $ctag ) {
echo '<span class="custom_tag" title="'. $ctag .'">'. $ctag .'</span>';
}
}
?>
</div>
</div>
<?php
$type_terms = get_the_terms( get_the_ID(), 'case_type' );
if ( $type_terms > 1 ):
$opengov_tag_list = get_the_term_list( get_the_ID(), 'innovation-tag-opengov' );
if ( !empty( $opengov_tag_list ) ):
?>
<div class="post_tags_wrap">
<div class="post_tags">
<h4><?php echo __( 'Open Government tags:', 'opsi' ); ?></h4>
<?php echo get_the_term_list( get_the_ID(), 'innovation-tag-opengov' ); ?>
</div>
</div>
<?php endif; endif; ?>
<div class="row">
<div class="col-md-12">
<?php echo get_collaborators_list( get_the_ID() ); ?>
</div>
</div>
<?php if ( !empty( $upload_images ) ) { ?>
<div class="cs_sidebar_wrap">
<div class="row">
<div class="col-md-12">
<h4 class="gallery_label"><?php echo __( 'Media:', 'opsi' ); ?></h4>
<div class="gallery_wrap">
<?php
$g = 0;
foreach ( $upload_images as $upimg ) {
echo '<a href="' . $upimg['sizes']['large'] . '" title="'.$upimg['title'].'" class="featuredimglinked fancybox" data-fancybox="gallery" >';
echo '<img src="'.$upimg['sizes']['tiny'].'" alt="'.$upimg['title'].'" width="'. $upimg['sizes']['tiny-width'] .'" height="'. $upimg['sizes']['tiny-height'] .'"" />';
echo '</a>';
}
?>
</div>
</div>
</div>
</div>
<?php } ?>
<?php if ( !empty( $upload_files ) ) { ?>
<div class="cs_sidebar_wrap">
<div class="row">
<div class="col-md-12">
<h4 class="files_label"><?php echo __( 'Files:', 'opsi' ); ?></h4>
<div class="files_wrap">
<ul class="nodots nospace">
<?php
foreach ( $upload_files as $file ) {
$icon = '<i class="fa fa-file-archive-o" aria-hidden="true"></i>';
if ( $file['subtype'] = 'pdf' ) {
$icon = '<i class="fa fa-file-pdf-o" aria-hidden="true"></i>';
}
echo '
<li>
<a href="' . $file['url'] . '" title="'.$file['title'].'" target="_blank" >
'. $icon .' '.$file['title'].'
</a><small class="help-block">'. $file['description'] .'</small>
</li>
';
}
?>
</ul>
</div>
</div>
</div>
</div>
<?php } ?>
<div class="cs_post_meta">
<div class="row">
<div class="col-xs-12">
<span class="strong make-block">
<?php echo __( 'Date published:', 'opsi' ); ?>
</span>
<span class="make-block">
<?php echo get_the_date(); ?>
</span>
</div>
</div>
</div>
<?php if ( !is_user_logged_in() ) { ?>
<div class="cs_sidebar_wrap">
<div class="row">
<div class="col-md-12">
<?php echo do_shortcode('[joinorlogin]'); ?>
</div>
</div>
</div>
<?php } ?>
</div>
</div>
<?php endwhile; ?>
</div>
<?php wp_reset_query(); ?>
<?php get_footer(); ?>