Support » Fixing WordPress » How to get author’s name on posts (automatically)?

  • Resolved wickedwidget

    (@wickedwidget)


    Hi
    I’ve just set up a blog – I’m the administrator and I’ve added one contributor.

    Is there a way of configuring the blog so that the author’s name appears below the post (next to / under categories etc)?

Viewing 5 replies - 1 through 5 (of 5 total)
  • You have to add some code to the template pages.

    Something like this

    <?php the_title(); ?>"><?php the_title(); ?></a></h2>
    	<p align="right"><b>By <?php the_author(); ?></b> | <?php the_time('F j, Y'); ?></p>

    Hi,

    You need to add author tag code in page.php file of your wordpress theme..

    This is an example of code which needs to be add:

    <?php
    include (TEMPLATEPATH, "/author.php");
    ?>

    That’s it!

    Thanks,

    Shane G.

    Hi – I tried adding code to page.php but nothing happened –

    then I dug around in index.php and saw <?php the_author() ?> was commented out – so I uncommented and author’s name appeared…

    bit puzzled that the page.php didn’t react at all to my changes – I actually added a new div with background red, height 100px etc to check whether changes were registering – and they weren’t -mystifying stuff

    but thanks for pointing me in right direction

    cheers
    Chris N

    page.php applies to when you are viewing a Page
    single.php (or index if one doesn’t exist) applies when viewing a single post

    stvwlf had the solution, and Shane seemed to sidetrack off to something else…

    <?php
    include (TEMPLATEPATH, "/author.php");
    ?>

    Will do nothing if the theme doesn’t have an author.php file…

    Author pages are not what was asked for, so i’m totally baffled why it was suggested anyway.

    You’re all sorted now anyway, so no matter… 🙂

    I changed it in index.php and page.php here (snippet):

    <div class="postmetadata">Posted by <?php the_author(', ') ?> | <?php the_time('F jS, Y') ?></div>

    I guess it may depend on the theme you are using. But if you see a spot that has the_category in the code and you would like to replace it with the author name, then replace the_category with the_author in any page you wish.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘How to get author’s name on posts (automatically)?’ is closed to new replies.