This guest post was written by Jeffro of Jeffro2pt0. Jeffro is a WordPress enthusiast who writes a lot about WordPress and maintains a WordPress Weekly podcast. If you have WordPress knowledge and are interested in writing a guest post for Hack WordPress, please contact us.
Ever wanted that ability to show your bio information within your WordPress profile at the bottom of every post? For single user blogs, this might not be practical. But for multi-authored blogs, adding the bio info of each author at the bottom of their respective posts is a good way to give props to the author as well as providing information to the readers as to who that person is without having to refer to an about me page. The good news is that, you don’t need to install a plugin to have this functionality.

Inside of a user profile is this nifty little box where you can place information about yourself. As you can see, I have already placed some info into the box for reference later on in the tutorial. We are going to take the information in this box and display it at the bottom of every post that is under my name.
The template tag we are going to focus on is <?php the_author_description(); ?> This tag doesn’t accept any parameters, so don’t bother trying to do anything funky with this tag. Now, head to your templates Style sheet and add this to it:
.postauthor { }
This will give us the opportunity to style the postauthor bit when it’s published in the post. Now that we have the template tag in order, we will need to place it within the loop.
I’m not going to delve into the specifics of the loop, but in general, it deals with the information related to posts. Browse to your themes index.php file and look for something like this:
< ?php the_content('Read the rest of this entry »'); ?>
That is what it looks like in my theme, it may look different in yours, but this is the function that displays the content of the post. Underneath of this content function is where you would want to place the following code:
< div class="postauthor ">< ?php the_author_description(); ? >< /div>
Please keep in mind that if the code does not work, it is most likely due to the spaces which I had to add in order for the code to properly appear within this post. Simply remove the spaces, and the code should be just fine.
Now that you have the author description function in place, this is what it might look like on your blog:

If you ask me, this looks bland and boring. We need to fix that by editing the div class called Postauthor within the CSS file and give that Div class a nice look. You can style it to match your blog design, but for the sake of this tutorial, I’ll display the CSS code which makes it appear like the TAG div container shown below the Post Author.
.postauthor {
color: #222222;
font-family: Arial, Helvetica, sans-serif;
font-size: 14px;
font-weight: normal;
background: #EAEAEA;
border-top: 2px solid #000000;
border-bottom: 1px solid #000000;
width: 640px;
padding: 3px;
margin-bottom:5px;
}
This CSS style code turns that small black text into something like this:
Roughly four months ago I talked a bit about how to set up your blog so only the admin can see an edit button on blog posts. For whatever reason, I’ve always set this up on each of my websites and really get a lot of use out of it. Much along those same lines, Michael of WPCandy has written a post explaining how to display content so only the admin can view it. This goes well beyond the edit button and allows you to setup just about anything to display for the admin.
In hist post, Michael provides some code that looks at the user id to determine if the user has admin privileges and then displays whatever you tell it to for that user. Here is the code:
<?php global $user_ID; if( $user_ID ) : ?>
<?php if( current_user_can('level_10') ) : ?>
<a href=”http://yourdomainurl.com/stats/“>Stats</a>
<?php else : ?>
<?php endif; ?>
<?php endif; ?>
If you run a multi-author blog and would like to make this stuff available to editors, authors, contributors, and more, you can easily adjust the user level to determine who sees your display.
Great find Michael!
On one of my main blogs I maintain several reference posts which are updated regularly in the hopes that they remain a valid resource for my readers. So far these posts have proven to be pretty beneficial to search engine traffic and well received by readers that reference them regularly.
If you run a blog where posts are regularly updated, you may want to consider updating your post meta data to also reflect the last modified date when applicable, rather than showing just the original posting date.
In order to do this, Ardamis has posted a quick code hack to get your single pages to reflect the last modified date. He uses the default Kubrick theme, but it easily apply to just about any theme.
As always, you’ll want to make a backup of your single.php file (or any files you will be changing) before proceeding.
Look for the code that displays the post date. It should look something like the following:
Posted on: <?php the_time('l, F jS, Y') ?>
Now replace it with the following code (slightly modified from Ardamis’ post):
Posted on <?php the_time('F jS, Y') ?>
<?php $u_time = get_the_time('U');
$u_modified_time = get_the_modified_time('U');
if ($u_modified_time != $u_time) {
echo "and last modified on ";
the_modified_time('F jS, Y');
echo ". "; } ?>
Now your posts should show the last modified date immediately after the original posting date, rather than just showing the original post date! I use this on most of my blogs and I am very pleased with it.
Most WordPress themes, by default, come with Recent Posts displayed automatically. Depending on the type of blog you run, it is possible that you would prefer to display Recent Posts per category. If this is the case, here is what you need to do to only display recent posts for specific categories.
First, you’ll want to find your Recent Posts code, which is usually found in the sidebar. It will look something like this:
<h2>Recent Posts</h2>
<ul>
<?php get_archives('postbypost', 10); ?>
</ul>
As always, make sure you have a backup of the file in question before making any changes. You’ll then want to replace the above code with the following code:
<ul>
<?php $recent = new WP_Query("cat=1&showposts=10"); while($recent->have_posts()) : $recent->the_post();?>
<li><a href="<?php the_permalink() ?>" rel="bookmark">
<?php the_title(); ?>
</a></li>
<?php endwhile; ?>
</ul>
Where is says cat=1, you’ll want to insert the number assigned to the category that you want to display the posts from. You can find this from your Manage -> Categories page. You can also adjust the number of posts to be displayed where it says showposts=10.
This could be useful to someone who wants to display the most recent few posts from a few different categories in their sidebar.
In the past we’ve gone over some methods for setting up your theme to separate your author comments in WordPress. By default, most WordPress themes check the e-mail address to determine who the person is that is leaving the comment. By adjusting the code to check for the user id instead, you can set up your theme to recognize if you are the author of the post. This is also beneficial for blogs with multiple authors.
In addition to separating trackbacks from comments, this is another way you can easily help improve the readers experience when trying to follow a conversation in the comments. Most people use a different background, but some choose to instead display a logo. The important thing is that readers can recognize which comments are coming from the author of the post.
Today I noticed Matt Cutts has written his own tutorial explaining how to highlight author comments in WordPress. His post also includes the code needed for CSS styling. If you still haven’t gotten around to doing this on your theme yet, I recommend you check it out!
One thing more WordPress bloggers have been doing lately is moving their categories over to a horizontal menu, rather than displaying them in the sidebar. Depending on the type of blog you run and how well you keep your categories organized, I think this can be a great idea to help manage the website and improve overall navigation. Doing something like this allows for a much better use of sub-categories, and gives you the option of displaying them in a drop-down to give your blog a much more professional feeling.
If you are interested in moving your WordPress categories into a menu and then displaying sub-categories in a drop-down menu, Anthology of Ideas has taken the time to write a detailed post explaining how to display WordPress categories in a horizontal drop-down menu. You can also view their menu to see if you like it. I recommend you check it out before attempting this on your own.
Of course doing this will require the use of Javascript, but the author does a great job of detailing the process and provides the CSS required to style it properly. Once you have everything up and running correctly, you can then adjust the colors and margins to give your new menu the look and feel you want it to have, as well as fully integrate it into your WordPress theme.
I like the idea of having the sub-categories be drop-down menus, but one downside I see is that displaying categories in a menu sort of eliminates using a traditional menu for your pages. It would be hard, in my opinion, to achieve a good look with more than one menu, so you then have to find a different way to display your blog pages. I think you are probably best off using this method mostly if you are trying to achieve a magazine-style look or some sort of a content management system (CMS).
What do you think of moving your categories to a menu and displaying your sub-categories in drop-down boxes?












