-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathsingle-oer.php
executable file
·198 lines (189 loc) · 8.24 KB
/
single-oer.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
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
<?php
/**
* The template for displaying all single posts
*
* @link https://developer.wordpress.org/themes/basics/template-hierarchy/#single-post
*
* @package Lauch
*/
get_header();
$args = array(
'post_type' => 'page',
'meta_query' => array(
array(
'key' => '_wp_page_template',
'value' => 'oer-overview.php'
)
)
);
$overview = get_posts($args);
while (have_posts()) :
the_post();
$terms = get_the_terms($post, 'oer-topics');
?>
<header class="c-page-alpaca-header">
<div class="c-page-alpaca-featured medium-up as-s p-r">
<img src="<?php echo get_the_post_thumbnail_url(get_the_ID(), 'blog-alpaka'); ?>"
alt="">
<div class="c-page-alpaca-friend">
<?php
$svg = get_random_illustration();
echo get_svg_content($svg); ?>
</div>
</div>
<div class="c-page-alpaca-title">
<nav class="c-breadcrumb" aria-label="breadcrumb">
<ol>
<li>
<a href="<?php echo get_post_permalink($overview[0]->ID); ?>">OER</a>
</li>
</ol>
</nav>
<h1 class="c-page-title pt-1"><?php the_title() ?></h1>
<div class="c-page-excerpt">
<?php the_excerpt(); ?>
</div>
</div>
</header>
<div class="c-page-section white pb-4">
<ul class="c-category-list">
<?php foreach ($terms as $term) : ?>
<li class="c-category-list-item">
<a href="<?= get_term_link($term->slug, 'oer-topics'); ?>"
class="c-tag"
title="Mehr zum Thema <?= $term->name ?>">
<?= $term->name ?>
</a>
</li>
<?php endforeach; ?>
</ul>
<div class="c-page-wide">
<ul class="c-metadata">
<li class="c-metadata-item">
<img src="<?php echo get_template_directory_uri() ?>/images/meta_icons/people.png" alt="" width="160"
height="160">
<div class="c-metadata-item-wrapper">
<dl>
<dt>Alter</dt>
<dd><?php the_field('age') ?></dd>
</dl>
<dl>
<dt>Anzahl</dt>
<dd><?php the_field('participants') ?></dd>
</dl>
</div>
</li>
<li class="c-metadata-item">
<img src="<?php echo get_template_directory_uri() ?>/images/meta_icons/hourglass.png" alt="" width="160"
height="160">
<div class="c-metadata-item-wrapper">
<dl>
<dt>Vorbereitung</dt>
<dd><?php the_field('preparation') ?> h</dd>
</dl>
<dl>
<dt>Dauer</dt>
<dd><?php the_field('duration') ?> h</dd>
</dl>
</div>
</li>
<li class="c-metadata-item c-metadata-item-column">
<div class="c-metadata-item-wrapper">
<dl class="d-b">
<dt>Schwierigkeit</dt>
<dd>
<?php
$difficulty = intval(get_field('difficulty'));
for($i = 0; $i < 5; $i++) : ?>
<img src="<?php echo get_template_directory_uri() ?>/images/meta_icons/level-<?= $i < $difficulty ? 'full' : 'empty' ?>.png"
class="c-metadata-item-difficulty"
alt="" width="100" height="50">
<?php endfor; ?>
</dd>
</dl>
</div>
</li>
<?php if (get_field('download_project')) : ?>
<li class="c-metadata-item c-metadata-item-column">
<img src="<?php echo get_template_directory_uri() ?>/images/meta_icons/download_project.png" alt="" width="160" height="160">
<div class="c-metadata-item-wrapper">
<dl class="d-b">
<dt>Projektbeschreibung</dt>
<dd>
<?php foreach (get_field('download_project') as $download) : $url = wp_get_attachment_url($download['file']); ?>
<a href="<?= $url ?>" target="_blank"><?= wp_check_filetype($url)['ext'] ?></a>
<?php endforeach; ?>
</dd>
</dl>
</div>
</li>
<?php endif; ?>
<?php if (get_field('download_zim')) : ?>
<li class="c-metadata-item c-metadata-item-column">
<img src="<?php echo get_template_directory_uri() ?>/images/meta_icons/download_zim.png" alt="" width="160" height="160">
<div class="c-metadata-item-wrapper">
<dl class="d-b">
<dt>Ziele, Inhalte, Methoden</dt>
<dd>
<?php foreach (get_field('download_zim') as $download) : $url = wp_get_attachment_url($download['file']); ?>
<a href="<?= $url ?>" target="_blank"><?= wp_check_filetype($url)['ext'] ?></a>
<?php endforeach; ?>
</dd>
</dl>
</div>
</li>
<?php endif; ?>
<li class="c-metadata-item c-metadata-item-column">
<img src="<?php echo get_template_directory_uri() ?>/images/meta_icons/cc.png" alt="" width="160" height="160">
<div class="c-metadata-item-wrapper">
<dl class="d-b">
<dt><a href="<?= get_field('cc')['value']; ?>" target="_blank"><?= get_field('cc')['label']; ?></a></dt>
<dd><?= strip_tags(get_field('author'),'<a>') ?></dd>
</dl>
</div>
</li>
<?php if (get_field('external_link_url')) : ?>
<li class="c-metadata-item c-metadata-item-column">
<img src="<?php echo get_template_directory_uri() ?>/images/meta_icons/google_drive.png" alt="" width="160" height="160">
<div class="c-metadata-item-wrapper">
<dl class="d-b">
<a href="<?= get_field('external_link_url') ?>" target="_blank"><?= get_field('external_link_title') ?></a>
</dl>
</div>
</li>
<?php endif; ?>
</ul>
</div>
<div class="c-page-standard c-page-wide wp-styles">
<div class="c-page-capital-first pt-5"><?php the_content(); ?></div>
</div>
</div>
<?php
$args = array('post_type' => 'oer',
'posts_per_page' => 3,
'post__not_in' => array(get_the_ID()),
'orderby' => 'rand',
'tax_query' => array(
array(
'taxonomy' => 'oer-topics',
'terms' => array_map(function ($n) {
return $n->term_id;
}, $terms)
)));
$the_query = new WP_Query($args);
if ($the_query->have_posts()) : ?>
<section class="pt-5">
<ul class="c-page-3col c-blog-list is-grid">
<?php while ($the_query->have_posts()) : $the_query->the_post(); ?>
<li class="fg-0">
<?php get_template_part('template-parts/content', 'teaser'); ?>
</li>
<?php endwhile; ?>
<?php wp_reset_postdata(); ?>
</ul>
</section>
<?php endif; ?>
<?php
endwhile; ?>
<?php
get_footer();