Skip to content

Instantly share code, notes, and snippets.

@omeha2
Created November 12, 2015 22:52
Show Gist options
  • Save omeha2/fba82fe387b13f2c866d to your computer and use it in GitHub Desktop.
Save omeha2/fba82fe387b13f2c866d to your computer and use it in GitHub Desktop.
Shortcode for showing post author box - [bc_author_box]
add_shortcode( 'bc_author_box', function($attr,$content = ''){
$out = '<style>
.bc_author_box {
border: 1px solid #D8D8D8;
white-space: nowrap;
line-height: 0;
}
.bc_author_box .avatar {
display: inline-block;
width: 25%;
height: auto;
}
.bc_author_right {
display: inline-block;
white-space: normal;
width: 75%;
vertical-align: top;
padding: 10px;
line-height: 140%;
}
.bc_author_link {
float: right;
}
</style>
<div class="bc_author_box">'.
get_avatar( get_the_author_meta('email'), '128', '/images/no_images.jpg', get_the_author_meta('display_name') ).
'<div class="bc_author_right">
<div class="bc_author_name">'.get_the_author_meta('display_name').
'<a href="'.get_author_posts_url( get_the_author_meta( 'ID' ) ).'" class="bc_author_link">See more from this author</a>
</div>
<div class="bc_author_bio">'.
get_the_author_meta('description')
.'</div>
</div>
</div>';
return $out;
} );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment