Building credibility on a blog involves letting people know something about the author of the posts. While there are various plugins available, you can use Headway to maintain branding and build some notoriety through this quick code snippet.
This tutorial requires the use of a child theme. If you don’t have one, learn how to make one in 5 minutes or less!
The PHP and CSS Code for an Author Box
Adding a little “about the author” section to the end of blog posts is incredibly easy when using the Headway hooks system. Simply copy and paste the following code into the functions.php file of your child theme:
//Post Footer
function hwexp_post_footer() {
if(is_single()) { ?>
<div id="post-footer">
<p>
<?php echo get_avatar( get_the_author_email(), '124' ); ?>
<h3>About <?php the_author_meta('display_name'); ?></h3>
<?php the_author_meta('description'); ?></p>
</div>
<?php }
}
add_action('headway_after_entry_content', 'hwexp_post_footer', 1);
Now for the styling. Copy and paste the following code into the custom.css or style.css file of your child theme:
/* Post Footer */
body.custom div#post-footer {background: #F3F2F2; border: 1px dashed #ddd; overflow: hidden; padding: 10px; margin-bottom: 10px; margin-top: 10px; font-size: 14px; width: 100%;}
body.custom div#post-footer img {float: left; display: inline; margin-right: 10px;}
body.custom div#post-footer h3 {font-weight: bold;}
You can change your display name, email address, and author bio in the WordPress dashboard by editing your account profile. You can also find additional author meta info to add to this code by looking at the WordPress Author Meta Function Reference.
Obviously this approach will work for adding other content after your blog posts. Simple use the hook ‘headway_after_entry_content’ along with a conditional tag like “if(is_single())” and you’ll be able to include things like social media buttons, subscription boxes, videos, etc.
Any Questions?
What questions do you have about adding an author bio to the end of your blog posts? Share your thoughts and experiences in the comments section.
