forked from interglobalvision/pindropstudio-com
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpage-sound-and-vision.php
executable file
·136 lines (118 loc) · 3.41 KB
/
page-sound-and-vision.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
<?php
get_header();
$luminary = get_query_var('luminary');
?>
<main id="main-content">
<section id="posts" class="container">
<div class="grid-row margin-bottom-small">
<?php render_divider('<span class="drawer-toggle u-pointer" data-drawer-id="drawer-luminaries-sort">Sort by Luminary +</span>'); ?>
</div>
<div id="drawer-luminaries-sort" class="<?php if (empty($luminary)) {echo 'drawer-content ';} ?>margin-bottom-basic">
<div class="grid-row">
<div class="grid-item item-s-12">
<ul id="luminaries-sort-list">
<?php
$exclude_category = get_category_by_slug('luminary-without-media');
$luminaries = new WP_Query(array(
'post_type' => 'luminaries',
'posts_per_page' => -1,
'order' => 'ASC',
'orderby' => 'meta_value',
'meta_key' => '_igv_surname',
'category__not_in' => $exclude_category->term_id,
));
if ($luminaries->have_posts()) {
if (!empty($luminary)) {
echo '<li><a href="' . home_url('sound-and-vision') .'">All</a></li><li> </li>';
}
while ($luminaries->have_posts()) {
$luminaries->the_post();
?>
<li><a href="?luminary=<?php the_id(); ?>" <?php if ($luminary == $post->ID) {echo 'class="font-underline"';} ?>><?php the_title(); ?></a></li>
<?php
}
}
?>
</ul>
</div>
</div>
</div>
<div class="shuffle-section media-items">
<div class="shuffle-preloader"></div>
<div class="shuffle-container grid-row hidden">
<?php
if (!empty($luminary)) {
// filter query. gets events which have video or audio meta set and orders them by the datetime meta (which also needs to be set)
$args = array(
'post_type' => array('event', 'recording'),
'posts_per_page' => get_option('posts_per_page'),
'meta_query' => array(
array(
'key' => '_igv_related_luminaries_array',
'value' => '"' . $luminary . '"',
'compare' => 'LIKE'
),
array(
'relation' => 'OR',
array(
'key' => '_igv_vimeo_id',
'compare' => 'EXISTS'
),
array(
'key' => '_igv_soundcloud_url',
'compare' => 'EXISTS'
)
)
),
'meta_key' => '_igv_event_datetime',
'orderby' => 'meta_value_num',
);
} else {
// basic query. gets events which have video or audio meta set and orders them by the datetime meta (which also needs to be set)
$args = array(
'post_type' => array('event', 'recording'),
'posts_per_page' => get_option('posts_per_page'),
'meta_query' => array(
'relation' => 'OR',
array(
'key' => '_igv_vimeo_id',
'compare' => 'EXISTS'
),
array(
'key' => '_igv_soundcloud_url',
'compare' => 'EXISTS'
)
),
'meta_key' => '_igv_event_datetime',
'orderby' => 'meta_value_num',
);
}
$events_query = new WP_Query($args);
if( $events_query->have_posts() ) {
while( $events_query->have_posts() ) {
$events_query->the_post();
get_template_part('partials/custom-pages/event-media');
?>
<?php
}
} else {
?>
<article class="u-alert shuffle-item item-s-12">
<?php
if (!empty($luminary)) {
_e('Sorry, this luminary has no recordings yet');
} else {
_e('Sorry, no posts matched your criteria');
}
?>
</article>
<?php
} ?>
</div>
</div>
</section>
<?php get_template_part('partials/pagination'); ?>
</main>
<?php
get_footer();
?>