1

What do I need to do in order to have the author name in the blog posts on my wordpress blog?

currently when I view a post it doesn't have the author that wrote the post.

2 Answers 2

0

This will be somewhat dependent on where your single post view is stored, but you'd be looking to add something to the effect of:

<?php

echo __('Written by', 'text_domain') .' <a href="'. get_author_posts_url(get_the_author_meta('ID')) .'" rel="author" class="fn">'. get_the_author() .'</a>';
2
0

The code needs to go in single.php, which you'll most likely find in your theme folder. If you are using a child theme, you might not see it; in which case, copy the file from the parent theme to your child theme folder. The WordPress function you need is the_author, so to get the author's name, add something like this inside the loop:

 <p>This post was written by <?php the_author(); ?></p>    

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.