There is a lot of functionality that a plugin can add to your WordPress configuration, but for some reason I can’t feel comfortable relying simply on plugins for everything. When something simple comes along that can be done without a plugin, I would much rather go that route. With that said, I had been looking for an easy way to add some information about the author to display on every article. It turns out that this is VERY easy to do and DOES NOT require any plugins to accomplish. This solution uses some WordPress hooks…To start, there are two files that you will need to edit, single.php and style.css.
In your single.php simply find the area you would like to display your “About the author” information and paste the following.
<!-- Start About the Author --> <div id="author-info"> <div id="author-image"> <a href="<?php the_author_meta('user_url'); ?>"><?php echo get_avatar( get_the_author_meta('user_email'), '90', '' ); ?></a> </div> <div id="author-bio"> <h4><?php the_author_link(); ?></b> has written <b><?php the_author_posts(); ?></b> Articles at <a href="https://computingondemand.com"><b>C.O.D.</b></a></h4><br /> <p><?php the_author_meta('description'); ?></p> </div> </div> <!-- End About the Author -->
You can change the size of the avatar by modifying the number in this string:
<?php echo get_avatar( get_the_author_meta('user_email'), '90', '' ); ?>
Your next edit is to your style.css, copy and paste the following:
#author-info { background : #eaeaec ; padding : 10px; margin : 0 0 15px 0; -moz-border-radius : 8px; -webkit-border-radius: 8px; border-radius : 8px; overflow : auto; } #author-info div #author-image { float : left; margin : 0 10px 5px 0; border : 5px solid #DCDCE1; }
Enjoy!
Note: These functions are not of my own creation, simply things I have found along the way. If you are the author of this function, please let me know so I can properly credit you with your work!
<?php echo get_avatar( get_the_author_meta('user_email'), '90', '' ); ?>
One comment
Pingback: News and Links for August 23rd 2010