-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathauthor-info.php
48 lines (37 loc) · 1.27 KB
/
author-info.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
<?php
/**
* Display the author's name and bio within blog posts
*
* @package OKFNWP
*/
if ( function_exists( 'coauthors' ) ) :
get_template_part( 'author', 'info-coauthors' );
else :
$okf_author = get_the_author();
$okf_author_description = get_the_author_meta( 'description' );
$okf_avatar = get_avatar( get_the_author_meta( 'ID' ), 80 );
/*
Prepare a suitable URL for the Gravatar user profile, as recommended here:
* https://en.gravatar.com/site/implement/profiles/
*/
$okf_avatar_url = 'https://www.gravatar.com/' . md5( get_the_author_meta( 'user_email' ) );
if ( empty( $okf_author_description ) ) :
$okf_author_description = __( 'No description set for this author.', 'okfnwp' );
endif;
if ( $okf_author ) :
?>
<aside class="author-info">
<a class="author-info_link" href="<?php echo esc_url( $okf_avatar_url ); ?>">
<span class="author-info_thumbnail"><?php echo wp_kses_post( $okf_avatar ); ?></span>
</a>
<h4 class="author-info_name">
<?php
// translators: %1$s stands for the author name.
echo esc_html( sprintf( __( 'About %1$s', 'okfnwp' ), get_the_author_meta( 'display_name' ) ) );
?>
</h4>
<p><?php echo wp_kses_post( $okf_author_description ); ?></p>
</aside>
<?php
endif;
endif;