PluginProbe
Jetpack – WP Security, Backup, Speed, & Growth / 7.6.2
Jetpack – WP Security, Backup, Speed, & Growth v7.6.2
16.3-a.3 16.3-a.1 16.2 16.2-beta 12.0.3 12.1.3 12.2.3 12.3.2 12.4.2 12.5.2 12.6.4 12.7.3 12.8.3 12.9.5 13.0.2 13.1.5 13.2.4 13.3.3 13.4.5 13.5.2 13.6.2 13.7.2 13.8.3 13.9.2 14.0.1 All 504 releases
jetpack / modules / theme-tools / content-options / author-bio.php

author-bio.php in Jetpack – WP Security, Backup, Speed, & Growth 7.6.2, at modules/theme-tools/content-options/author-bio.php

61 lines 1.9 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * The function to display Author Bio in a theme.
4 */
5 function jetpack_author_bio() {
6 // If the theme doesn't support 'jetpack-content-options', don't continue.
7 if ( ! current_theme_supports( 'jetpack-content-options' ) ) {
8 return;
9 }
10
11 $options = get_theme_support( 'jetpack-content-options' );
12 $author_bio = ( ! empty( $options[0]['author-bio'] ) ) ? $options[0]['author-bio'] : null;
13 $author_bio_default = ( isset( $options[0]['author-bio-default'] ) && false === $options[0]['author-bio-default'] ) ? '' : 1;
14
15 // If the theme doesn't support 'jetpack-content-options[ 'author-bio' ]', don't continue.
16 if ( true !== $author_bio ) {
17 return;
18 }
19
20 // If 'jetpack_content_author_bio' is false, don't continue.
21 if ( ! get_option( 'jetpack_content_author_bio', $author_bio_default ) ) {
22 return;
23 }
24
25 // If we aren't on a single post, don't continue.
26 if ( ! is_single() ) {
27 return;
28 }
29 ?>
30 <div class="entry-author">
31 <div class="author-avatar">
32 <?php
33 /**
34 * Filter the author bio avatar size.
35 *
36 * @param int $size The avatar height and width size in pixels.
37 *
38 * @module theme-tools
39 *
40 * @since 4.5.0
41 */
42 $author_bio_avatar_size = apply_filters( 'jetpack_author_bio_avatar_size', 48 );
43
44 echo get_avatar( get_the_author_meta( 'user_email' ), $author_bio_avatar_size );
45 ?>
46 </div><!-- .author-avatar -->
47
48 <div class="author-heading">
49 <h2 class="author-title"><?php printf( esc_html__( 'Published by %s', 'jetpack' ), '<span class="author-name">' . get_the_author() . '</span>' ); ?></h2>
50 </div><!-- .author-heading -->
51
52 <p class="author-bio">
53 <?php the_author_meta( 'description' ); ?>
54 <a class="author-link" href="<?php echo esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ); ?>" rel="author">
55 <?php printf( esc_html__( 'View all posts by %s', 'jetpack' ), get_the_author() ); ?>
56 </a>
57 </p><!-- .author-bio -->
58 </div><!-- .entry-auhtor -->
59 <?php
60 }
61