-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathstaff-template.php
64 lines (50 loc) · 2.07 KB
/
staff-template.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
<?php
/* Template Name: Staff Page template */
?>
<?php get_header(); ?>
<?php if(have_posts()): ?>
<?php while(have_posts()): the_post();?>
<div class="container">
<div class="row">
<div class="col">
<h1><?php the_title(); ?></h1>
<div class="wp_content">
<?php the_content(); ?>
</div>
</div>
</div>
<div class="row">
<?php
// $allStaffMembers = new WP_Query('post_type=staff&order=ASC&orderby=title');
$args = array(
'post_type' => 'staff',
'order' => 'ASC',
'orderby' => 'title',
'posts_per_page' => -1
);
$allStaffMembers = new WP_Query($args);
?>
<?php if( $allStaffMembers->have_posts() ): ?>
<?php while($allStaffMembers->have_posts()): $allStaffMembers->the_post();?>
<div class="card">
<?php if( has_post_thumbnail() ): ?>
<?php the_post_thumbnail('thumbnail', ['class'=>'card-img-top img-fluid', 'alt'=>'Card image cap']); ?>
<?php endif; ?>
<div class="card-body">
<h5 class="card-title"><?php the_title(); ?></h5>
<?php
$id = get_the_id();
$staffRole = get_post_meta($id, 'staffRole', true);
?>
<?php if($staffRole): ?>
<p><?= $staffRole; ?></p>
<?php endif; ?>
</div>
</div>
<?php endwhile; ?>
<?php endif; ?>
</div>
</div>
<?php endwhile; ?>
<?php endif; ?>
<?php get_footer(); ?>