Advertisement
Guest User

Author Box

a guest
Jan 8th, 2020
132
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.23 KB | None | 0 0
  1. <?php
  2. // Get Author Data
  3. $author = get_the_author();
  4. $author_description = get_the_author_meta( 'description' );
  5. $author_url = esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) );
  6. $author_avatar = get_avatar( get_the_author_meta( 'user_email' ), apply_filters( 'wpex_author_bio_avatar_size', 75 ) );
  7. // Only display if author has a description
  8. if ( $author_description ) : ?>
  9. <div class="author-info clr">
  10.  <h4 class="heading"><span><?php printf( esc_html__( 'Written by %s', 'text_domain' ), esc_html( $author ) ); ?></span></h4>
  11.  <div class="author-info-inner clr">
  12.  <?php if ( $author_avatar ) { ?>
  13.  <div class="author-avatar clr">
  14.  <a href="<?php echo esc_url( $author_url ); ?>" rel="author">
  15.  <?php echo $author_avatar; ?>
  16.  </a>
  17.  </div><! - .author-avatar →
  18.  <?php } ?>
  19.  <div class="author-description">
  20.  <p><?php echo wp_kses_post( $author_description ); ?></p>
  21.  <p><a href="<?php echo esc_url( $author_url ); ?>" title="<?php esc_html_e( 'View all author posts', 'text_domain' ); ?>"><?php esc_html_e( 'View all author posts', 'text_domain' ); ?> →</a></p>
  22.  </div><! - .author-description →
  23.  </div><! - .author-info-inner →
  24.  </div><! - .author-info →
  25. <?php endif; ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement