-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathauthor.php
More file actions
161 lines (116 loc) · 3.92 KB
/
author.php
File metadata and controls
161 lines (116 loc) · 3.92 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
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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
<?php
/**
* The template for displaying the author pages
*
* Learn more: https://codex.wordpress.org/Author_Templates
*
* @package Understrap
*/
// Exit if accessed directly.
defined( 'ABSPATH' ) || exit;
get_header();
$container = get_theme_mod( 'understrap_container_type' );
?>
<div class="wrapper" id="author-wrapper">
<div class="<?php echo esc_attr( $container ); ?>" id="content" tabindex="-1">
<div class="row">
<!-- Do the left sidebar check -->
<?php get_template_part( 'global-templates/left-sidebar-check' ); ?>
<main class="site-main" id="main">
<header class="page-header author-header">
<?php
$curauth = (get_query_var('author_name')) ? get_user_by('slug',
get_query_var('author_name')) :
get_userdata(get_query_var('author'));
?>
<h1 class="entry-title"><?php echo get_the_author(); ?></h1>
<div class="wp-block-columns" style="place-content: center;">
<?php echo get_avatar( get_the_author_meta('ID'), '100' ); ?>
<dl style="width: 100%;">
<dt><?php esc_html_e( 'Website', 'understrap' ); ?></dt>
<dd>
<p>
<a href="<?php echo esc_url( $curauth->user_url ); ?>">
<?php echo esc_html( $curauth->user_url ); ?></a>
</p>
</dd>
<dt><?php esc_html_e( 'Profile', 'understrap' ); ?></dt>
<dd><?php echo the_author_meta('description'); ?></dd>
</dl>
</div>
<h2 class="entry-title"><?php echo esc_html( 'Posts & Pages', 'understrap' ); ?>:</h2>
</header><!-- .page-header -->
<?php
$args = array(
'posts_per_page' => 10,
'paged' => get_query_var( 'paged' ),
'post_type' => array('post', 'page'),
'author_name' => get_the_author_meta('user_nicename'),
'orderby' => 'post_date',
);
$loop = new WP_Query( $args );
?>
<?php
while ( $loop->have_posts() ) : $loop->the_post();
?>
<article <?php post_class(); ?> id="post-<?php the_ID(); ?>">
<!-- ENTRY HEADER -->
<header class="entry-header">
<?php
the_title(
sprintf( '<h2 class="entry-title"><a href="%s" rel="bookmark">',
esc_url( get_permalink() ) ),
'</a></h2>'
);
?>
</header>
<!-- .entry-header -->
<div class="entry-content">
<div class="d-flex flex-row">
<?php echo get_the_post_thumbnail( $post->ID, 'thumbnail' ); ?>
<div class="excerpt flex-grow-1">
<?php the_excerpt(); ?>
</div>
<?php
wp_link_pages(
array(
'before' => '<div class="page-links">' . __( 'Pages:', 'understrap' ),
'after' => '</div>',
)
);
?>
</div>
</div>
<footer class="entry-footer">
<?php
if ( 'post' === get_post_type() ) {
$categories_list = get_the_category_list( esc_html__( ', ', 'understrap' ) );
if ( $categories_list && understrap_categorized_blog() ) {
printf( '<span class="cat-links">' .
esc_html__( 'Posted in %s', 'understrap' ) .
'</span>', $categories_list );
}
}
$tags_list = get_the_tag_list( '', esc_html__( ', ', 'understrap' ) );
if ( $tags_list ) {
printf( '<span class="tags-links">' .
esc_html__( 'Tagged %s', 'understrap' ) .
'</span>', $tags_list );
}
?>
</footer>
<p>Posted on <?php echo get_the_date(); ?></p>
</article>
<?php endwhile; wp_reset_query();?>
</main><!-- #main -->
<!-- The pagination component -->
<!-- altered to count pages and posts -->
<?php understrap_pagination([
'total' => $loop->max_num_pages,
]); ?>
<!-- Do the right sidebar check -->
<?php get_template_part( 'global-templates/right-sidebar-check' ); ?>
</div> <!-- .row -->
</div><!-- #content -->
</div><!-- #author-wrapper -->
<?php get_footer(); ?>