-
Notifications
You must be signed in to change notification settings - Fork 53
/
author-bio.php
executable file
·68 lines (65 loc) · 1.76 KB
/
author-bio.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
<?php
/**
* Author description.
*/
if ( get_the_author_meta( 'description' ) ) :
?>
<div class="author-info
<?php
if ( ! is_single() ) :
?>
bg-faded<?php endif; ?>">
<div class="row">
<div class="col-sm-12">
<h2>
<?php
echo get_avatar( get_the_author_meta( 'user_email' ), apply_filters( 'themes_starter_author_bio_avatar_size', 48 ) ) . ' ';
printf( esc_html__( 'About %s', 'my-theme' ), get_the_author() );
?>
</h2>
<p class="author-description">
<?php the_author_meta( 'description' ); ?>
</p>
<p class="author-links">
<?php
if ( ! empty( get_the_author_meta( 'user_url' ) ) ) {
printf( '<a href="%s" class="www btn btn-secondary btn-sm">' . esc_html__( 'Website', 'my-theme' ) . '</a>', esc_url( get_the_author_meta( 'user_url' ) ) );
}
// Add new Profile fields for Users in functions.php
$fields = array(
array(
'meta' => 'facebook_profile',
'label' => 'Facebook',
),
array(
'meta' => 'twitter_profile',
'label' => 'Twitter',
),
array(
'meta' => 'linkedin_profile',
'label' => 'LinkedIn',
),
array(
'meta' => 'xing_profile',
'label' => 'Xing',
),
array(
'meta' => 'github_profile',
'label' => 'GitHub',
),
);
foreach ( $fields as $key => $data ) {
$author_link = get_the_author_meta( esc_attr( $data['meta'] ) );
if ( ! empty( $author_link ) ) {
$label = $data['label'];
echo ' <a href="' . esc_url( $author_link ) . '" class="btn btn-secondary btn-sm" title="' . esc_attr( $label ) . '">' . esc_html( $label ) . '</a> ';
}
}
?>
</p>
</div><!-- /.col -->
</div><!-- /.row -->
</div><!-- /.author-info -->
<?php
endif;
?>