WordPress Wednesdays: Adding Author Byline to Standard Theme

January 26, 2011 — 11 Comments

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.

herbhalstead

Posts Twitter Facebook

Herb is the lead pastor at Thrive Church. Herb also does freelance web design, 3D architectural modeling, and works as an architectural designer.

11 responses to WordPress Wednesdays: Adding Author Byline to Standard Theme

  1. Cool Herb. I have been playing around with something like this on my site.

    • 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.

  2. A couple other files you can apply this same procedure to are:

    archive.php
    search.php

    P.S. I just changed ours to read: “Written by AuthorName”

  3. Great tip. Will check it out!

  4. 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.

    • 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.

  5. Just did this! I’ve been wanting to do this for awhile on some of the blogs I manage. Thanks man!

  6. Glad you shared. Great stuff. I will be definitely checking out more of these post.

Trackbacks and Pingbacks:

  1. Tweets that mention WordPress Wednesdays: Adding Author Byline to Standard Theme | GeekRev -- Topsy.com - January 26, 2011

    […] This post was mentioned on Twitter by Adam, geekrevdotcom. geekrevdotcom said: WordPress Wednesdays: Adding Author Byline to Standard Theme → http://thriveguy.com/8k […]

Leave a Reply

Text formatting is available via select HTML.

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong> 

*