-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathpage-projekte.php
173 lines (123 loc) · 4.22 KB
/
page-projekte.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
<?php
/*
Template Name: Page Projekte
*/
get_header();
// Get the categories for regions:
$region_parent_obj = get_term_by('name', 'region', 'page_category');
$region_parent_id = $region_parent_obj->term_id;
$args = array(
'child_of' => $region_parent_id,
'orderby' => 'name',
'order' => 'ASC',
'hide_empty' => 1,
'hierarchical' => 1,
'taxonomy' => 'page_category',
);
$regions = array();
foreach (get_categories( $args ) as $key => $value) {
$regions[$value->slug] = $value->name;
}
$order = array('berlin', 'oesterreich', 'schweiz', 'nord', 'ost', 'sued', 'west', 'hamburg', 'dresden', 'koeln', 'ulm');
uksort($regions, function ($a, $b) use ($order) {
$pos_a = array_search($a, $order);
$pos_b = array_search($b, $order);
if($pos_a === false) $pos_a = count($order)+1;
if($pos_b === false) $pos_b = count($order)+1;
return $pos_a - $pos_b;
});
// Get the categories for years:
$year_parent_obj = get_term_by('slug', 'year', 'page_category');
$year_parent_id = $year_parent_obj->term_id;
$args = array(
'child_of' => $year_parent_id,
'orderby' => 'name',
'order' => 'ASC',
'hide_empty' => 0,
'hierarchical' => 1,
'taxonomy' => 'page_category',
);
$years = array();
foreach (get_categories( $args ) as $key => $value) {
$years[] = $value->name;
}
// Get the projects
$projects = get_field('hackdash_projects');
// Extract all Badges in use -> build the legend
// foreach ($projects as $key => $project) {
// $allBadges[] = $project['project_badge'][0];
// }
// $allBadges = array_unique($allBadges);
$field = get_field_object('hackdash_projects');
// get the proper names for badge choices
// foreach ($field['sub_fields'] as $key => $subfield) {
// if($subfield['name'] === 'project_badge'){
// $choiceNames = $subfield['choices'];
// }
// }
?>
<div id="content" data-speed="3" >
<div id="inner-content" class="wrap clearfix">
<div id="main" role="main">
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
<section class="isotope-container twelvecol first entry-content" >
<div class="grid-sizer"></div>
<div class="gutter-sizer"></div>
<div id="filters" class="entry-content teaser-item" itemprop="articleBody">
<div class = "filter-years background-panel">
<a class="filter-year active" data-filter-year ="*" >Alle</a>
<?php
arsort($years);
if(!empty($years)) {
foreach ($years as $key => $year) {
?>
<a class="filter-year" data-filter-year = ".filter-me-as-<?php echo $year ?>" > <?php echo $year ?> </a>
<?php
}
}
?>
</div>
<div class = "filter-regions background-panel">
<h2 class="filter-region active" data-filter-region="*" >Alle</h2>
<?php
if(!empty($regions)) {
foreach ($regions as $key => $region) { ?>
<h2 class="filter-region" data-filter-region=".filter-me-as-<?php echo $key ?>" > <?php echo $region ?> </h2>
<?php
}
}
?>
</div>
<!-- <div class="badge-legend-wrap">
<?php
foreach ($allBadges as $key => $badge) { ?>
<h3 class="badge-legend badge-legend-<?php echo $badge; ?> filter" data-filter=".badge-<?php echo $badge; ?>" > <?php echo $choiceNames[$badge]; ?> </h3>
<?php }
?>
</div> -->
</div> <!-- end article section -->
<!-- project teasers-->
<?php
if( !empty($projects) ) {
foreach ($projects as $key => $project) {
include('partials/project-teaser.php');
}
} ?>
</section>
<?php endwhile; else : ?>
<article id="post-not-found" class="hentry clearfix">
<header class="article-header">
<h1><?php _e("Oops, Post Not Found!", "bonestheme"); ?></h1>
</header>
<section class="entry-content">
<p><?php _e("Uh Oh. Something is missing. Try double checking things.", "bonestheme"); ?></p>
</section>
<footer class="article-footer">
<p><?php _e("This is the error message in the page.php template.", "bonestheme"); ?></p>
</footer>
</article>
<?php endif; ?>
</div> <!-- end #main -->
</div> <!-- end #inner-content -->
</div> <!-- end #content -->
<?php get_footer(); ?>