Getting Your WordPress Byline to Display

Posted on June 9, 2008
Filed Under WordPress, php |

The other day a friend of mine started a new blog called Transformation of the Suns. He found a WordPress theme he liked, but after he added his first post, he noticed that his name didn’t appear on the page.

He asked me if I could help.

If you are an expert in php programming this would be easy. But for those of you who are not, here are the easy steps to customize your WordPress blog so that your name appears under your blog post title.

The first step is to edit the index.php page of your theme. You will find a line of code something like this: <div class=”main_title”><a href=”<?php the_permalink() ?>” rel=”bookmark”><?php the_title(); ?></a></div>

You need to insert this small piece of code just before the closing </div> tag. Here is what you need to insert: <h5>by <?php the_author() ?></h5>

Obviously, it doesn’t have to be surrounded by a <h5> tag, but you do need to format it somehow. In this case, I opened up the style sheet and added a h5 heading and styled it appropriately, giving it a letter spacing of .4em.

And there is one more step. You need to add the same small bit of code to the single.php page to the same line as on the index.php page. When finished, the line looks like this: <div class=”main_title”><a href=”<?php the_permalink() ?>” rel=”bookmark”><?php the_title(); ?></a><h5>by <?php the_author() ?></h5>
 </div>.

That’s it.

This little bit of tweaking is important if you ever want to have a guest writer create a post on your blog. Everybody wants to receive their due credit.

Comments

Leave a Reply