Support » Fixing WordPress » How to show who writes a post

Viewing 15 replies - 1 through 15 (of 16 total)
  • I’m little helpless with php and everything, so can you help me?

    I want to put that ‘who submited the post’ thing on my blogs too. In which file and where there i should put that ‘Posted by <?php the_author_nickname(); ?>’ ?

    This would go in your index.php file for your theme within “the loop”.

    To get an idea of how that’d work, look at /wp-content/themes/default/index.php and look at line #11. You will see the call to the_author() there and notice that it’s been commented out.


    Thanks for that.

    One more question 😛

    How can you put a tag around the_author that it mails to that author, who has written concerned blog?

    Like if i wrote then there will be my nick and link ‘mailto:’. And if my pal wrote there, then that mail link replaced by my pals mail.

    Not needing help anymore, i found the answer from that page where was that the_author thing too 😛

    thank you for the fast help!!!!!!!!!!!!!!!!!!

    I have a similar question:

    My blog ( will soon be accepting contributions from guest authors. I would like to indicate the author of these posts, but I don’t want authorship to show up when I, the admin, is the author (which is most of the time).

    Any suggestions for limiting the author php code, so that it only works with “editor” or “author” user roles, and not for “admin” role?


    Tfleming, a simple way to do this would be:

    <?php if('admin' != get_the_author_login()) the_author(); ?>

    Thanks, Kafkaesqui

    That seems to work, but I need a small adjustment. I replaced to commented-out basic ” by <?php the_author(); ?> “

    I need to move the “by” inside the

    “by <?php if(‘admin’ != get_the_author_login()) the_author(); ?>”

    so that it doesn’t show up when the authorship isn’t displayed.

    Very new to php coding, obviously, but I tried to move it various places by looking at other code elements. Thought it might just be easiest to ask you, where do I put this?

    Thanks for your help!!


    <?php if('admin' != get_the_author_login()) echo 'by ' . get_the_author(); ?>

    Wow… that seemed to work! But it introduced a new problem. I need to now insert a break if it displays the author other than admin, but not if the author is admin. Where inside that php code would I put this?

    While I’m asking, is it possible to also include in that code a call to the author’s image (again, when other than admin) so that it displays next to each entry they post?

    I need to now insert a break if it displays the author other than admin, but not if the author is admin.

    That’s a bit vague. Where does the break go?

    is it possible to also include in that code a call to the author’s image

    Certainly, but I’ve no idea what you’re using (if anything) to display author images.

    Sorry, more or less a newbie…. I’ll try to clarify. Here’s the code as it stands:

    <h2>” rel=”bookmark” title=”Permanent Link to <?php the_title(); ?>”><?php the_title(); ?></h2>
    <small> <?php if(‘admin’ != get_the_author_login()) echo ‘by ‘ . get_the_author(); ?>
    <?php the_time(‘F jS, Y’) ?>

    This prints the title (as a permalink), then on the next line the author’s name (unless the admin) and the date.
    I need to put a break between the author’s name and the date, but only if not an admin.

    If I just a <br> before the date code now, I get an empty line between the title and date if the author is the admin. So, I presume I need to insert the <br> somewhere in the code you provided earlier so that it only shows up when the admin is not the author.

    On the images question, is there a way to create a code that calls the image up (sorry if not using the right terminology) the same way that <?php get_the_author(); ?> calls up the author’s name?
    Something like <?php get_the_author_photo(); ?>
    which…I suppose… would have to be stored somewhere in their WordPress profile? Maybe put the src= in their biographical information box?


    RE: Inserting a break only when author is displayed…

    <?php if('admin' != get_the_author_login()) echo 'by ' . get_the_author() . '<br />'; ?>

    Here’s a less unwieldy version:

    <?php if('admin' != get_the_author_login()) : ?>
    by <?php the_author(); ?><br />
    <?php endif; ?>

    RE: Author image…

    There are a number of ways to accomplish this, but probably the simplest is to upload images for your authors based on some component of their profile, such as ID or login, and use that for the dynamic part to your image *code*. Here’s an <img> tag example using user/author ID (ID.jpg) as the image filename:

    <img src="/images/authors/<?php the_author_ID(); ?>.jpg" alt="<?php the_author(); ?>" />

    A somewhat more complete author image solution would be found in a plugin like:

    Plugin: Author Image(s)

    I’m having the hardest time using this, or the author images plugin.
    No matter what i use, all i get is the ouput of the author name..but no image.
    Please help!!!!!!!

    I inserted this
    <img src=”/images/authors/<?php the_author_ID(); ?>.jpg” alt=”<?php the_author(); ?>” />
    into my index, and i have the images in the /images/authors/ folder…no luck

Viewing 15 replies - 1 through 15 (of 16 total)
  • The topic ‘How to show who writes a post’ is closed to new replies.