WordPress.org

Ready to get started?Download WordPress

Forums

Query author name - the Geek-ie way (9 posts)

  1. katie1
    Member
    Posted 8 years ago #

    Could someone please kindly advise where I should put this beautiful code?

    I tried before the Loop, as such:

    <div id="maincontainer">
    [p class="breadcrumb"> All Titles By:
    <?php
    global $wp_query;
    $author = $wp_query->get_queried_object();
    echo $author->first_name . ' ' . $author->last_name;
    ?>

    [/p]
    </div>

    I couldn't get it output the author name.

    Have I missed an important piece of code somewhere?

  2. Kafkaesqui

    Posted 8 years ago #

    Oops! Forgot you're one of our 1.5.2 folk still:

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

    2.0 really is a different animal...

  3. katie1
    Member
    Posted 8 years ago #

    Thanks - will try it and report back if a no-goer.

  4. katie1
    Member
    Posted 8 years ago #

    Eekkk!

    It worked!

    Well, I just knew it.

    You really are brilliant!

    PS: I won't upgrade until all the bugs are smashed to smithereans - is that a proper word?

    Anyway, I don't like madness :(

  5. Kafkaesqui

    Posted 8 years ago #

    "You really are brilliant!"

    I had other options at the ready in case I wasn't. :/

    Note: smithereens. Like the group, you know.

  6. katie1
    Member
    Posted 8 years ago #

    *laughing hilariously*

  7. Good grief, I thought I was the only one who knew about them....

  8. spabizgal
    Member
    Posted 7 years ago #

    Ok I am really new at this but my posts don't show the author either and I would want them too. I just installed WP a week ago 1-10-07.

    With this in mind, what is this "loop" everyone is talking about and what file and where do I insert this.. lOL

    Again over my head here LOL

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

  9. Kafkaesqui

    Posted 7 years ago #

    The Loop

    To display author information *in* The Loop, check out the Author template tags:

    http://codex.wordpress.org/Template_Tags#Author_tags

Topic Closed

This topic has been closed to new replies.

About this Topic