-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathauthor.php
30 lines (30 loc) · 907 Bytes
/
author.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
<?php
$userInfo = get_userdata( get_query_var('author'));
$isAuthor = true;
if (
!in_array('contributor', $userInfo -> roles) &&
!in_array('administrator', $userInfo -> roles) &&
!in_array('author', $userInfo -> roles) &&
!in_array('editor', $userInfo -> roles)
) {
$isAuthor = false;
wp_redirect(esc_url( home_url() ) . '/404', 404);
}
?>
<?php get_header(); ?>
<main class="container">
<div class="row">
<div id="content" role="main">
<header>
<?php if ($isAuthor === true): ?><h1><?php _e('Posts by: ', 'b4st'); echo get_the_author_meta( 'display_name' ); ?></h1><?php endif; ?>
</header>
<?php if(have_posts()): ?>
<?php get_template_part('loops/index-loop'); ?>
<?php else: ?>
<?php get_template_part('loops/index-none'); ?>
<?php endif; ?>
</div><!-- /#content -->
<?php get_sidebar(); ?>
</div><!-- /.row -->
</main><!-- /.container -->
<?php get_footer(); ?>