WordPress.org

Ready to get started?Download WordPress

Forums

Sidebar widget for post authors (5 posts)

  1. LeSte
    Member
    Posted 5 years ago #

    Hi everyone,
    I'm looking for a way to display a list of post authors in the sidebar, and link the names to the Authors website URL.
    So far, what i found are 2 things:

    1/
    <?php wp_list_authors('show_fullname=1&optioncount=1'); ?> which displays a list of Post authors but links them to authors archive...

    2/

    <?php
    $order = 'user_nicename';
    $user_ids = $wpdb->get_col("SELECT ID FROM $wpdb->users ORDER BY $order"); // query users
    foreach($user_ids as $user_id) : // start authors' profile "loop"
    $user = get_userdata($user_id);
    ?>
    <?php echo 'user_url . '">' . $user->display_name . ''; ?>
    <?php
    endforeach; // end of authors' profile 'loop'
    ?>

    which doesn't work anymore...

    So if anyone can help, it would be more than welcome!

  2. Samuel B
    moderator
    Posted 5 years ago #

  3. LeSte
    Member
    Posted 5 years ago #

    thanks for the quick reply, but this page explains how to display information about current author (the author of a given post), but i'm looking for a way to display a list of all authors posting on the blog...

  4. MichaelH
    Member
    Posted 5 years ago #

    Consider downloading and installing Otto's PHP Code Widget.

    Then use the template tag, wp_list_authors(), in one of those widgets:

    <?php wp_list_authors('show_fullname=1&optioncount=1&hide_empty=1'); ?>

    Please remember to support our plugin authors by clicking on the Donate button there.

  5. MichaelH
    Member
    Posted 5 years ago #

    Oops, see that you don't want a link to the author's posts so try:

    <?php
    $order = 'user_nicename';
    $user_ids = $wpdb->get_col("SELECT ID FROM $wpdb->users ORDER BY $order"); // query users
    foreach($user_ids as $user_id) : // start authors' profile "loop"
    $user = get_userdata($user_id);
    echo '<p>Author: ' . $user->display_name . ' Author URL: ' . $user->user_url . '</p>' ;
    endforeach; // end of authors' profile 'loop'
    ?>

Topic Closed

This topic has been closed to new replies.

About this Topic