-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy patharchive-date-simple.php
80 lines (73 loc) · 3.6 KB
/
archive-date-simple.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
<?php
/**
* Template Name: Terminübersicht NL
*
* The template for displaying archive pages
*
* @link https://developer.wordpress.org/themes/basics/template-hierarchy/
*
* @package Lauch
*/
get_header();
?>
<section class="c-page-section jc-c c-page-2col">
<div class="col-50">
<header class="c-page-section pb-2">
<h1 class="mt-0 mb-3">Kalender</h1>
<p>Schnelle Übersicht über alle kommenden Termine - vor allem für Philip und den Newsletter :)</p>
</header>
<div class="c-toc c-toc--horizontal">
<ul class="c-toc-nav">
<li><a href="#labs" class="hover-line-trigger <?= isset($_GET['lab_id']) ? "is-active" : '' ?>">
<span class="hover-line"><?php echo __('Labs', 'lauch'); ?></span></a></li>
</ul>
<div class="c-toc-content c-events-list">
<section id="labs" <?= isset($_GET['lab_id']) ? 'class="is-active"' : '' ?>>
<?php
foreach ([true, false] as $is_active) :
$all_dates = array();
$args = array(
'post_type' => 'date',
'orderby' => 'begin',
'order' => $is_active ? 'ASC' : 'DESC',
'posts_per_page' => -1,
'meta_query' => array(
'begin' => post_date_get_timed_query($is_active),
)
);
if (isset($_GET['lab_id'])) {
$args['meta_query']['parent'] = array(
'key' => 'parent', // name of custom field
'value' => $_GET['lab_id'],
'compare' => 'LIKE'
);
}
$the_query = new WP_Query($args);
post_date_get_sorted($the_query); ?>
<?php if ($the_query->have_posts()) : ?>
<h2><?= $is_active ? 'Kommende Termine' : 'Vergangene Termine' ?></h2>
<?php while ($the_query->have_posts()) : $the_query->the_post();
$info = array('lab' => get_field('parent')->post_title,
'link' => get_post_permalink(),
'img' => get_post_thumbnail_id(),
'title' => $post->post_title,
'date_technical' => post_date_get_datetime(),
'date' => $is_active ? post_date_format_date_simple() : post_date_format_date_simple_y());
array_push($all_dates, $info);
endwhile;
wp_reset_postdata();
endif;
foreach ($all_dates as $d) : ?>
<p><?php echo $d['date']; ?> <strong><?php echo $d['lab']; ?></strong> - <?php echo $d['title']; ?></p>
<?php endforeach;
endforeach; ?>
<?php if ( isset( $_GET['lab_id']) && $_GET['lab_id'] !== '' ) : ?>
<p class="c-page-copy"><a href="/kalender/?lab_id">Alle Labs anzeigen</a></p>
<?php endif; ?>
</section>
</div>
</div>
</div>
</section>
<?php
get_footer();