-
Notifications
You must be signed in to change notification settings - Fork 104
/
author.php
88 lines (79 loc) · 2.12 KB
/
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
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
<?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();
b4st_main_before();
?>
<main id="site-main" class="mt-5">
<header class="mb-5 text-center">
<?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()):
get_template_part('loops/index-loop');
else:
get_template_part('loops/index-none');
endif;
?>
<?php
/*
Did you want a traditional article-plus-sidebar layout?
=======================================================
Use this below instead of the one line above -- and
remove some of the CSS styles controlling `.entry-content`
<div class="container">
<div class="row">
<div class="col-sm">
<div id="content" role="main">
<header class="mb-5">
<?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>
</div>
<?php get_sidebar(); ?>
</div>
</div>
*/
?>
</main>
<?php
b4st_main_after();
if(is_active_sidebar('main-widget-area')): ?>
<section id="site-main-widgets" class="bg-light">
<div class="container">
<div class="row pt-5 pb-4" id="main-widget-area" role="navigation">
<?php
b4st_main_widgets_before();
dynamic_sidebar('main-widget-area');
b4st_main_widgets_after();
?>
</div>
</div>
</section>
<?php endif;
get_footer();
?>