jetpack_author_bio

The function to display Author Bio in a theme.

Description

jetpack_author_bio(); 

Usage

  1. if ( !function_exists( 'jetpack_author_bio' ) ) { 
  2. require_once '/modules/theme-tools/content-options/author-bio.php'; 
  3.  
  4.  
  5. // NOTICE! Understand what this does before running. 
  6. $result = jetpack_author_bio(); 
  7.  

Defined (1)

The function is defined in the following location(s).

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