-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patharchive-devices.php
88 lines (67 loc) · 3.65 KB
/
archive-devices.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
<?php get_header(); ?>
<?php
$post = array();
if ( isset($_GET["lab"]) ) {
} else {
$posts = get_posts(array(
'post_type' => 'devices',
'posts_per_page' => -1,
'orderby' => 'title',
'order' => 'ASC',
'tax_query' => array(
array(
'taxonomy' => 'ms_devices_workshop',
'field' => 'term_id',
'terms' => $_GET["lab"],
)
)
));
}
?>
<div class="container mt-5 pt-5 pt-md-0">
<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">
<div class="p-1 pl-2 pr-2 bg-white text-secondary">
<?php echo get_the_term_list($post->ID, 'ms_devices_workshop', 'Werkstatt ', '') ?>
</div>
<div class="p-1 pl-2 pr-2 bg-white text-secondary">
<?php
if (has_excerpt()) :
the_excerpt();
endif;
?>
</div>
</div>
</div>
</div>
<?php endforeach; ?>
</div>
</div>
<?php get_footer(); ?>