Skip to content

Instantly share code, notes, and snippets.

@thecodepoetry
Created October 9, 2019 06:20
Show Gist options
  • Save thecodepoetry/90c2c9e605528264d6f5eb97bfdfced3 to your computer and use it in GitHub Desktop.
Save thecodepoetry/90c2c9e605528264d6f5eb97bfdfced3 to your computer and use it in GitHub Desktop.
Autor box with link
function presscore_display_post_author() {
?>
<div class="author-info entry-author">
<?php
$avatar = presscore_get_avatar( get_the_author_meta( 'ID' ), 80 );
$authorlink = get_author_posts_url(get_the_author_meta('ID'));
if ( $avatar ) {
echo '<div class="author-avatar round-images"><a href="'.$authorlink.'">' . $avatar . '</a></div>';
} else {
echo '<span class="author-avatar no-avatar"></span>';
}
?>
<div class="author-description">
<h4><a href="<?php echo $authorlink; ?>"><span class="author-heading"><?php _e( 'Author:', 'the7mk2' ); ?></span>&nbsp;<?php the_author_meta( 'display_name' ); ?></a></h4>
<?php
$user_url = get_the_author_meta('user_url');
if ( $user_url ) {
echo '<a class="author-link" href="' . esc_url( $user_url ) . '" rel="author">' . esc_html( $user_url ) . '</a>';
}
?>
<p class="author-bio"><?php the_author_meta( 'description' ); ?></p>
</div>
</div>
<?php
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment