-
Notifications
You must be signed in to change notification settings - Fork 0
/
archive-post.php
98 lines (78 loc) · 4.49 KB
/
archive-post.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
<?php get_header(); ?>
<?php
$location = $_GET['location'];
if (!$location) { $location = "makerspace"; }
$posts = get_posts( array(
'post_type' => 'devices',
'posts_per_page' => -1,
'orderby' => 'title',
'order' => 'ASC',
'tax_query' => array(
array(
'taxonomy' => 'locations',
'field' => 'slug',
'terms' => $location,
),
),
));
?>
<div class="container mt-5 pt-5 pt-md-0">
<div class="row">
<div class="col-12 col-md-6">
<a href="/?post_type=devices&location=makerspace"
id="tab-makerspace"
class="c-pointer p-3 justify-content-center align-items-center d-flex <?php if($location == 'makerspace') { echo "bg-primary text-light"; } else { echo "border border-secondary"; } ?>">Maker Space</a>
</div>
<div class="col-12 col-md-6">
<a href="/?post_type=devices&location=sfz"
id="tab-sfz"
class="c-pointer p-3 justify-content-center align-items-center d-flex <?php if($location == 'sfz') { echo "bg-primary text-light"; } else { echo "border border-secondary"; } ?>">Schüler Forschungszentrum</a>
</div>
</div>
<div class="row mt-5 ms-device-list">
<?php foreach($posts as $post): ?>
<?php $rooms = get_the_terms( $post->ID, 'locations') ?>
<?php $device_categories = get_the_terms( $post->ID, 'device_categories') ?>
<div class="col col-xl-3 col-md-6" onclick="window.location.href = '<?php echo get_permalink(); ?>'">
<div class="device-card mb-5 d-flex flex-column"
data-rooms="<?php foreach($rooms as $room) { echo $room->term_id . ','; if ($room->parent) { echo $room->parent . ','; } } ?>"
data-categories="<?php foreach($device_categories as $cat) { echo $cat->term_id . ','; if ($cat->parent) { echo $cat->parent . ','; } } ?>"
style="cursor: pointer;">
<?php if ( has_post_thumbnail() ): ?>
<div class="device-card-thumbnail"
style="background-image: url(<?php the_post_thumbnail_url( 'medium' ); ?>);">
</div>
<?php else: ?>
<div class=""
style="height: 250px; background-image: url(<?php echo get_template_directory_uri(); ?>/assets/images/image-missing.png); background-size: cover; background-position: center;">
</div>
<?php endif; ?>
<div class="bg-white flex-fill p-2 overflow-hidden text-nowrap">
<h5 class="" title="<?php the_title() ?>">
<?php the_title() ?>
</h5>
</div>
<div class="p-0 pt-auto" style="font-size: 0.72rem;">
<!-- <div class="p-1 pl-2 pr-2 bg-white text-secondary">Führerschein 01-001</div> -->
<div class="p-1 pl-2 pr-2 bg-white text-secondary">
<?php echo get_the_term_list( $post->ID, 'locations', 'Standort ', '') ?>
</div>
<div class="d-none">
<?php $timetable = get_timetable_devices($post->ID, getdate()) ?>
<?php foreach ($timetable as $hour): ?>
<?php if ($hour["closed"] == 1): ?>
<div class="device-closed" title="<?php echo $hour->hour ?> - <?php echo $hour->hour ++ ?> Uhr geschlossen"></div>
<?php elseif ($hour["booked"] == 1): ?>
<div class="device-booked" title="<?php echo $hour ?> - <?php echo $hour ++ ?> Uhr gebucht"></div>
<?php else: ?>
<div class="device-free" title="<?php echo $hour ?> - <?php echo $hour ++ ?> Uhr frei"></div>
<?php endif; ?>
<?php endforeach; ?>
</div>
</div>
</div>
</div>
<?php endforeach; ?>
</div>
</div>
<?php get_footer(); ?>