Make WordPress Core


Ignore:
Timestamp:
06/01/2007 05:43:24 AM (17 years ago)
Author:
markjaquith
Message:

Allow wp_list_authors() to optionally return. fixes #4323. see #3567.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/author-template.php

    r5444 r5624  
    179179        'optioncount' => false, 'exclude_admin' => true,
    180180        'show_fullname' => false, 'hide_empty' => true,
    181         'feed' => '', 'feed_image' => ''
     181        'feed' => '', 'feed_image' => '', 'echo' => true
    182182    );
    183    
     183
    184184    $r = wp_parse_args( $args, $defaults );
    185185    extract($r);
    186    
     186
     187    $return = '';
     188
    187189    // TODO:  Move select to get_authors().
    188190    $authors = $wpdb->get_results("SELECT ID, user_nicename from $wpdb->users " . ($exclude_admin ? "WHERE user_login <> 'admin' " : '') . "ORDER BY display_name");
    189    
     191
    190192    $author_count = array();
    191193    foreach ((array) $wpdb->get_results("SELECT DISTINCT post_author, COUNT(ID) AS count FROM $wpdb->posts WHERE post_status = 'publish' GROUP BY post_author") as $row) {
     
    202204
    203205        if ( !($posts == 0 && $hide_empty) )
    204             echo "<li>";
     206            $return .= '<li>';
    205207        if ( $posts == 0 ) {
    206208            if ( !$hide_empty )
     
    241243
    242244        if ( !($posts == 0 && $hide_empty) )
    243             echo "$link</li>";
    244     }
     245            $return .= $link . '</li>';
     246    }
     247    if ( !$echo )
     248        return $return;
     249    echo $return;
    245250}
    246251
Note: See TracChangeset for help on using the changeset viewer.