Changeset 28392
- Timestamp:
- 05/13/2014 06:01:33 AM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/author-template.php
r28362 r28392 330 330 * @return null|string The output, if echo is set to false. 331 331 */ 332 function wp_list_authors( $args = '') {332 function wp_list_authors( $args = '' ) { 333 333 global $wpdb; 334 334 … … 342 342 343 343 $args = wp_parse_args( $args, $defaults ); 344 extract( $args, EXTR_SKIP );345 344 346 345 $return = ''; … … 351 350 352 351 $author_count = array(); 353 foreach ( (array) $wpdb->get_results( "SELECT DISTINCT post_author, COUNT(ID) AS count FROM $wpdb->posts WHERE post_type = 'post' AND " . get_private_posts_cap_sql( 'post' ) . " GROUP BY post_author") as $row )352 foreach ( (array) $wpdb->get_results( "SELECT DISTINCT post_author, COUNT(ID) AS count FROM $wpdb->posts WHERE post_type = 'post' AND " . get_private_posts_cap_sql( 'post' ) . " GROUP BY post_author" ) as $row ) { 354 353 $author_count[$row->post_author] = $row->count; 355 354 } 356 355 foreach ( $authors as $author_id ) { 357 356 $author = get_userdata( $author_id ); 358 357 359 if ( $ exclude_admin && 'admin' == $author->display_name )358 if ( $args['exclude_admin'] && 'admin' == $author->display_name ) { 360 359 continue; 360 } 361 361 362 362 $posts = isset( $author_count[$author->ID] ) ? $author_count[$author->ID] : 0; 363 363 364 if ( ! $posts && $hide_empty )364 if ( ! $posts && $args['hide_empty'] ) { 365 365 continue; 366 367 if ( $show_fullname && $author->first_name && $author->last_name ) 366 } 367 368 if ( $args['show_fullname'] && $author->first_name && $author->last_name ) { 368 369 $name = "$author->first_name $author->last_name"; 369 else370 } else { 370 371 $name = $author->display_name; 371 372 if ( !$html ) { 372 } 373 374 if ( ! $args['html'] ) { 373 375 $return .= $name . ', '; 374 376 … … 376 378 } 377 379 378 if ( 'list' == $ style) {380 if ( 'list' == $args['style'] ) { 379 381 $return .= '<li>'; 380 382 } … … 382 384 $link = '<a href="' . get_author_posts_url( $author->ID, $author->user_nicename ) . '" title="' . esc_attr( sprintf(__("Posts by %s"), $author->display_name) ) . '">' . $name . '</a>'; 383 385 384 if ( ! empty( $feed_image ) || !empty( $feed) ) {386 if ( ! empty( $args['feed_image'] ) || ! empty( $args['feed'] ) ) { 385 387 $link .= ' '; 386 if ( empty( $ feed_image) ) {388 if ( empty( $args['feed_image'] ) ) { 387 389 $link .= '('; 388 390 } 389 391 390 $link .= '<a href="' . get_author_feed_link( $author->ID, $ feed_type) . '"';392 $link .= '<a href="' . get_author_feed_link( $author->ID, $args['feed_type'] ) . '"'; 391 393 392 394 $alt = ''; 393 if ( ! empty( $feed) ) {394 $alt = ' alt="' . esc_attr( $ feed) . '"';395 $name = $ feed;395 if ( ! empty( $args['feed'] ) ) { 396 $alt = ' alt="' . esc_attr( $args['feed'] ) . '"'; 397 $name = $args['feed']; 396 398 } 397 399 398 400 $link .= '>'; 399 401 400 if ( ! empty( $feed_image ) )401 $link .= '<img src="' . esc_url( $ feed_image) . '" style="border: none;"' . $alt . ' />';402 else402 if ( ! empty( $args['feed_image'] ) ) { 403 $link .= '<img src="' . esc_url( $args['feed_image'] ) . '" style="border: none;"' . $alt . ' />'; 404 } else { 403 405 $link .= $name; 406 } 404 407 405 408 $link .= '</a>'; 406 409 407 if ( empty( $ feed_image ) )410 if ( empty( $args['feed_image'] ) ) { 408 411 $link .= ')'; 409 } 410 411 if ( $optioncount ) 412 } 413 } 414 415 if ( $args['optioncount'] ) { 412 416 $link .= ' ('. $posts . ')'; 417 } 413 418 414 419 $return .= $link; 415 $return .= ( 'list' == $ style) ? '</li>' : ', ';416 } 417 418 $return = rtrim( $return, ', ');419 420 if ( ! $echo )420 $return .= ( 'list' == $args['style'] ) ? '</li>' : ', '; 421 } 422 423 $return = rtrim( $return, ', ' ); 424 425 if ( ! $args['echo'] ) { 421 426 return $return; 422 427 } 423 428 echo $return; 424 429 }
Note: See TracChangeset
for help on using the changeset viewer.