0

I am using a modified version of the Twenty Sixteen wordpress theme and I would like to have the author display at the top of the post.

Currently I have the author username being posted but this isn't what I want

Here is how I did it

    <?php the_title( '<h1 class="entry-title">', '</h1>' ); ?>
    <?php $username = get_userdata( $post->post_author ); ?>    
    <p style="display:inline-block;">Author: </p> <a href="<?php echo get_author_posts_url( $post->post_author ); ?>"><?php echo $username->user_nicename; ?></a>
    <?php the_date('m-d-Y', '<p>', '</p>'); ?>
    <br />

But like I said this displays 'Author : (username)' which is not what I want. I want their author name to display.

I know that I'm close. But when I try to replace the username portion nothing displays. So I must be doing that wrong.

1

Use the_author(); you can read more about it here.

| improve this answer | |
  • Perfect. Nice and easy. I knew I was close. Thanks for helping a noob out. Will accept answer when it lets me. – onTheInternet Feb 20 '17 at 16:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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