WordPress Wednesdays: Adding Author Byline to Standard Theme

UPDATE: This post is outdated. Here is the updated tip.

Matthew Snider usually occupies this space, but I (Herb) thought I’d share a WordPress tip this week. Here at GeekRev, we use Standard Theme. It is an excellent theme with tons of built-in features. But, as any techy blog owner would be, I can’t leave well enough alone. Along with some CSS modifications, I have a few coded modifications too. Since we have multiple authors posting here, one of those modifications I added is an author byline in the “post meta” section of posts (under the post titles). I want to show you how to do that today.

The byline looks like this on GeekRev – see my name under the comment count?:

There are two places where I want the byline to show up.

  1. On the front page post listings.
  2. On individual posts.

In order to do that I have to edit two files. You can edit these files directly in your WordPress Administration Panel, through the theme editor.

Lets tackle the front page. In the theme editor, click to open the MAIN INDEX TEMPLATE.

UPDATE: As John reminds us in the comments below, anytime you edit files, you should save a copy of the original file. A quick and easy way would be to open a text editor (notepad or textedit), copy the contents of the editor pane, paste into the text editor, then save.

Now, locate the post-meta section. It should look like the code below:

[PHP]<p class=”post-meta”>
<span class=”the_time”>
<?php the_time(‘F j, Y’); ?>
</span> <?php _e(‘in’,’standardtheme’); ?>
<span class=”the_category”>
<?php the_category(‘, ‘); ?>
</span> <?php _e(‘with’,’standardtheme’); ?>
<span class=”the_comment_link”>
<?php comments_popup_link(__(‘0 Comments’,’standardtheme’), __(‘1 Comment’,’standardtheme’), __(‘% Comments’,’standardtheme’)); ?></span>
</p>[/PHP]

You need to add the following line, right above the </p>:

[PHP]<br />This post was written by <?php the_author_posts_link(); ?>[/PHP]

The result should look like this:

[PHP]<p class=”post-meta”>
<span class=”the_time”>
<?php the_time(‘F j, Y’); ?>
</span> <?php _e(‘in’,’standardtheme’); ?>
<span class=”the_category”>
<?php the_category(‘, ‘); ?>
</span> <?php _e(‘with’,’standardtheme’); ?>
<span class=”the_comment_link”>
<?php comments_popup_link(__(‘0 Comments’,’standardtheme’), __(‘1 Comment’,’standardtheme’), __(‘% Comments’,’standardtheme’)); ?></span>
<br />This post was written by <?php the_author_posts_link(); ?>
</p>[/PHP]

Press the “Update File” button.

Ok, now let’s tackle the individual posts. In the theme editor, click to open the SINGLE POST file.

Again, locate the post-meta section. It should look like this:

[PHP]<p class=”post-meta”>
<span class=”the_time”>
<?php the_time(‘F j, Y’); ?>
</span> <?php _e(‘in’,’standardtheme’); ?>
<span class=”the_category”>
<?php the_category(‘, ‘); ?>
</span> <?php _e(‘with’,’standardtheme’); ?>
<span class=”the_comment_link”>
<?php comments_popup_link(__(‘0 Comments’,’standardtheme’), __(‘1 Comment’,’standardtheme’), __(‘% Comments’,’standardtheme’)); ?>
</span>
<?php edit_post_link(‘edit’,'<span>’,'</span>’) ?>
</p>[/PHP]

Add the following code right above the </p>:

[PHP]<br />This post was written by <?php the_author_posts_link(); ?>[/PHP]

The result should look like this:

[PHP]<p class=”post-meta”>
<span class=”the_time”>
<?php the_time(‘F j, Y’); ?>
</span> <?php _e(‘in’,’standardtheme’); ?>
<span class=”the_category”>
<?php the_category(‘, ‘); ?>
</span> <?php _e(‘with’,’standardtheme’); ?>
<span class=”the_comment_link”>
<?php comments_popup_link(__(‘0 Comments’,’standardtheme’), __(‘1 Comment’,’standardtheme’), __(‘% Comments’,’standardtheme’)); ?>
</span>
<?php edit_post_link(‘edit’,'<span>’,'</span>’) ?>
<br />This post was written by <?php the_author_posts_link(); ?>
</p>[/PHP]

Press the “Update File” button.

That’s it! Now people will know who wrote the article when they look at the the post’s meta information.

UPDATE: You may want to apply the same procedures to the archive.php and search.php files.

11 Replies to “WordPress Wednesdays: Adding Author Byline to Standard Theme”

    1. I like the way you’ve done yours, inline. I see a lot of themes do it that way, and it looks great. I have a lot of newspaper friends, and so I am biased about making sure the author gets his/her own line.

  1. Great tip but you forgot a very important step – back up the original files first!

    Also, this will have to be done again if you upgrade to a new version of the theme so make sure you document your changes somewhere.

    1. Good points, John. In fact, the “document your changes somewhere” suggestion is why I wrote this post (grin). Also, I suggest you always download the zip file copy of any theme you install. That way you’ll have the original files if something goes awry.

Leave a Reply

Your email address will not be published. Required fields are marked *