• Hi, Right now no author name appears at the bottom of posts on my site. This was okay when it was just me posting, but now I have added anothe author, so I would like our posts to have our names at the bottom. Can someone please tell me where to go in and change the code to get this to happen?

    http://kmareka.com

    Thanks!

Viewing 9 replies - 1 through 9 (of 9 total)
  • try

    <a href="<?php the_author_url(); ?>"><?php the_author('namefl'); ?>

    wherever you would like the author name to appear. You can also get rid of the <a href="<?php the_author_url(); ?>"> part if you do not want the authors name to be a link to the web site address that they entered in their profile.

    I could not get the <?php the _author('namefl'); ?> to work on my author page, before OR after the loop.

    Any suggestions, Kafkaesqui?

    katie1, the_author() should only be used *in* The Loop, as it’s a post-related template tag.

    If you can spell out what you’re trying to accomplish, I should be able to suggest something.

    I appreciate your help, Kafkaesqui,

    On my author.php, I want to use author(namefl) in my breadcrumb trail.

    It’s the only piece in the jigsaw that doesn’t display. I’ve inserted it after “if have posts” but before “while have posts” so that it doesn’t get displayed on each individual entry post.

    Any suggestions as to where I’m going wrong?

    The Loop 101 ( :) )

    The actual, honest to goodness looping portion of The Loop is what comes after while(have_posts()), whereas each post — including data such as post author, is typically accessable only after the_post() runs as it initializes the $post object and any accompanying data (such as from custom fields). So using the_author() before or after or somewhere very near but not quite in The Loop will typically fail, or at the very least provide inconsistent results.

    Soooooo….here’s a better (if geeky) way to do what you’re attempting:

    <?php
    global $wp_query;
    $author = $wp_query->get_queried_object();
    echo $author->first_name . ' ' . $author->last_name;
    ?>

    P.S. Thread hijacking? Tsk tsk. ;)

    oops.

    Thought I’d try it, to see how it felt 🙂

    I’ll try out your suggestion and report back in a brand new thread? Or should I go whole hog and kill my reputation altogether and reply again?

    Eh, this thread ain’t going anywhere…

    EDIT: katie1 topic:
    http://ww.wp.xz.cn/support/topic/58291

    New thread, it is 🙂

Viewing 9 replies - 1 through 9 (of 9 total)

The topic ‘making author name appear with post’ is closed to new replies.