-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy patharchive-person.php
61 lines (48 loc) · 1.38 KB
/
archive-person.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
<?php
/**
* The template for displaying archive pages.
*
* @link https://codex.wordpress.org/Template_Hierarchy
*
* @package chamber
*/
?>
<div class="grid"><?php get_template_part('templates/page', 'header'); ?></div>
<?php
$departments = get_terms('department', array('no_paging' => 1));
// cheat to move executive to top of listing
foreach($departments as $key => $val){
if($val->slug == 'executive'){
unset($departments[$key]);
array_unshift($departments, $val);
break;
}
}
foreach($departments as $department) {
wp_reset_query();
$args = [
'post_type' => 'person',
'posts_per_page' => -1,
'no_paging' => 1,
'meta_key' => 'people_weight',
'orderby' => 'meta_value_num',
'order' => 'ASC',
'tax_query' => [
[
'taxonomy' => 'department',
'field' => 'slug',
'terms' => $department->slug,
],
],
];
$loop = new WP_Query($args);
if ( $loop->have_posts() ) :
?>
<div class="grid-section-header"><h3 class="list-title"><?= $department->name ?></h3></div>
<div class="grid">
<?php while($loop->have_posts()) : $loop->the_post(); ?>
<?php get_template_part( 'templates/content/person' ); ?>
<?php endwhile; ?>
</div>
<?php endif; ?>
<?php } ?>