-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathauthor.php
More file actions
51 lines (44 loc) · 1.67 KB
/
author.php
File metadata and controls
51 lines (44 loc) · 1.67 KB
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
<?php
get_header();
// Obtain author by ID
$author_id = get_queried_object_id();
?>
<?php get_template_part('template-parts/sections/author-header'); ?>
<section class="category-latest">
<div class="c">
<div class="grid-50 clear-col-3">
<?php
//Posts written by the author
if (have_posts()):
while (have_posts()): the_post(); ?>
<div class="col-1-3">
<?php get_template_part('template-parts/components/article', null, ['class' => 'block']); ?>
</div><!-- col-1-3 -->
<?php endwhile;
endif;
// Posts reviewed by the author
$reviewer_query = new WP_Query([
'post_type' => 'post', //
'meta_query' => [
[
'key' => 'reviewer', // ACF field
'value' => $author_id,
'compare' => '='
]
],
'posts_per_page' => 10,
]);
if ($reviewer_query->have_posts()):
while ($reviewer_query->have_posts()): $reviewer_query->the_post(); ?>
<div class="col-1-3">
<?php get_template_part('template-parts/components/article', null, ['class' => 'block']); ?>
</div><!-- col-1-3 -->
<?php endwhile;
wp_reset_postdata();
endif;
?>
</div><!-- grid -->
<?php the_posts_pagination(); ?>
</div><!-- c -->
</section><!-- category-latest -->
<?php get_footer(); ?>