Support » Fixing WordPress » wp_list_authors – include authors who haven’t posted yet

  • I’ve spent a couple of days trying to get the following page to respond like I want:

    It’s perfect now … all authors listed, links to an author profile page, etc.

    Now … I’d like one tweak … is there a way to have a link to authors who have NOT posted yet? I realize there would be no posts on that page, but we could at least list their profile information. Sugguestions?

Viewing 7 replies - 1 through 7 (of 7 total)
  • I’m having the same issue – I’d like to be able to link to the author profile even though the author hasn’t posted yet. Any way to do this, short of creating fake posts for them?

    Check out Author_Templates#Linking_to_Author_Page_from_Sidebar and the References in that article.

    I have looked through the references, and still can’t find anything speaking to how to get authors with no posts to generate a link to their profile instead of just an echo of their name.

    See the site here: (It’s still being developed and populated with content.)

    In the sidebar, there is a box called ‘The Sundance 14’ and an author list with just two items in it (there are only two authors right now). That list is being generated with <?php wp_list_authors('show_fullname=1&exclude_admin=0&hide_empty=0'); ?>

    The user Michigan Theater has one post, and the user Ragtag Cinema has none. Ragtag doesn’t get a link to their profile page, but Michigan Theater does. This is the problem I’m trying to solve (not the creation of the list itself or the profile page itself), but can’t find any documentation on.

    So: is there a way to force a link for authors who don’t have posts?

    Seems wp_list_authors will not return a link if a user has no posts (even though it does allude to that in Codex).

    In my WordPress 2.0.1 test system, I made this change to the list_authors function in the wp-includes/template-functions-author.php file at around line 205

    change from
    $link = $name;

    $link = '<a href="' . '' . $author->ID . '" title="' . sprintf(__("Info about %s"), wp_specialchars($author->display_name)) . '">' . $name . '</a>';

    Note: I used your wp_list_authors tag for my test.

    Please be advised that changing core script files is not recommended and that you will need to remember these changes in the event you upgrade at a later date!

    Another idea is to consider using your Links to link to each author page by getting the link from that author page then pasting it into each Link’s URI.

    Good Luck.

    Gorgeous! Thanks so much – works like a charm.

    Great thanks for that tip. I modified the line so you don’t have to hard-code the URL in.

    $link = '<a href="' . get_settings('home') . '/?author_name=' . $author->user_login . '" title="' . sprintf(__("Info about %s"), wp_specialchars($author->display_name)) . '">' . $name . '</a>';

    / Hami

    I added a parameter $force_link and told it to make the link if $force_link was true even when the author has no posts.

    Needed to modify the code more but the choice to force or not to force is easier.

    It would be nice for this functionality to be added by default.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘wp_list_authors – include authors who haven’t posted yet’ is closed to new replies.