Ticket #4420: 4420.r10258.diff
File 4420.r10258.diff, 3.2 KB (added by , 16 years ago) |
---|
-
author-template.php
442 442 /** 443 443 * List all the authors of the blog, with several options available. 444 444 * 445 * optioncount (boolean) (false): Show the count in parenthesis next to the 446 * author's name. 447 * exclude_admin (boolean) (true): Exclude the 'admin' user that is installed by 448 * default. 449 * show_fullname (boolean) (false): Show their full names. 450 * hide_empty (boolean) (true): Don't show authors without any posts. 451 * feed (string) (''): If isn't empty, show links to author's feeds. 452 * feed_image (string) (''): If isn't empty, use this image to link to feeds. 453 * echo (boolean) (true): Set to false to return the output, instead of echoing. 445 * <ul> 446 * <li>optioncount (boolean) (false): Show the count in parenthesis next to the 447 * author's name.</li> 448 * <li>exclude_admin (boolean) (true): Exclude the 'admin' user that is 449 * installed bydefault.</li> 450 * <li>show_fullname (boolean) (false): Show their full names.</li> 451 * <li>hide_empty (boolean) (true): Don't show authors without any posts.</li> 452 * <li>feed (string) (''): If isn't empty, show links to author's feeds.</li> 453 * <li>feed_image (string) (''): If isn't empty, use this image to link to 454 * feeds.</li> 455 * <li>echo (boolean) (true): Set to false to return the output, instead of 456 * echoing.</li> 457 * <li>style (string) ('list'): Whether to display list of authors in list form 458 * or as a string.</li> 459 * <li>html (bool) (true): Whether to list the items in html for or plaintext. 460 * </li> 461 * </ul> 454 462 * 455 463 * @link http://codex.wordpress.org/Template_Tags/wp_list_authors 456 464 * @since 1.2.0 … … 463 471 $defaults = array( 464 472 'optioncount' => false, 'exclude_admin' => true, 465 473 'show_fullname' => false, 'hide_empty' => true, 466 'feed' => '', 'feed_image' => '', 'feed_type' => '', 'echo' => true 474 'feed' => '', 'feed_image' => '', 'feed_type' => '', 'echo' => true, 475 'style' => 'list', 'html' => true 467 476 ); 468 477 469 478 $r = wp_parse_args( $args, $defaults ); … … 487 496 if ( $show_fullname && ($author->first_name != '' && $author->last_name != '') ) 488 497 $name = "$author->first_name $author->last_name"; 489 498 490 if ( !($posts == 0 && $hide_empty) ) 499 if( ! $html ) { 500 if ( $posts == 0 ) { 501 if ( ! $hide_empty ) 502 $return .= $name . ', '; 503 } else 504 $return .= $name . ', '; 505 506 // No need to go further to process HTML. 507 continue; 508 } 509 510 if ( !($posts == 0 && $hide_empty) && 'list' == $style ) 491 511 $return .= '<li>'; 492 512 if ( $posts == 0 ) { 493 if ( ! $hide_empty )513 if ( ! $hide_empty ) 494 514 $link = $name; 495 515 } else { 496 516 $link = '<a href="' . get_author_posts_url($author->ID, $author->user_nicename) . '" title="' . sprintf(__("Posts by %s"), attribute_escape($author->display_name)) . '">' . $name . '</a>'; … … 526 546 527 547 } 528 548 529 if ( !($posts == 0 && $hide_empty) )549 if ( !($posts == 0 && $hide_empty) && 'list' == $style ) 530 550 $return .= $link . '</li>'; 551 else 552 $return .= $link . ', '; 531 553 } 532 if ( !$echo ) 554 555 $return = trim($return, ', '); 556 557 if ( ! $echo ) 533 558 return $return; 534 559 echo $return; 535 560 }