Changeset 28434
- Timestamp:
- 05/15/2014 05:27:18 PM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/category-template.php
r28432 r28434 486 486 } 487 487 488 if ( ! isset( $r['class'] ) )488 if ( ! isset( $r['class'] ) ) 489 489 $r['class'] = ( 'category' == $r['taxonomy'] ) ? 'categories' : $r['taxonomy']; 490 490 491 extract( $r ); 492 493 if ( !taxonomy_exists($taxonomy) ) 491 if ( ! taxonomy_exists( $r['taxonomy'] ) ) { 494 492 return false; 493 } 494 495 $show_option_all = $r['show_option_all']; 496 $show_option_none = $r['show_option_none']; 495 497 496 498 $categories = get_categories( $r ); 497 499 498 500 $output = ''; 499 if ( $ title_li && 'list' == $style )500 $output = '<li class="' . esc_attr( $class ) . '">' . $title_li. '<ul>';501 501 if ( $r['title_li'] && 'list' == $r['style'] ) { 502 $output = '<li class="' . esc_attr( $r['class'] ) . '">' . $r['title_li'] . '<ul>'; 503 } 502 504 if ( empty( $categories ) ) { 503 505 if ( ! empty( $show_option_none ) ) { 504 if ( 'list' == $ style )506 if ( 'list' == $r['style'] ) { 505 507 $output .= '<li class="cat-item-none">' . $show_option_none . '</li>'; 506 else508 } else { 507 509 $output .= $show_option_none; 510 } 508 511 } 509 512 } else { … … 511 514 $posts_page = ( 'page' == get_option( 'show_on_front' ) && get_option( 'page_for_posts' ) ) ? get_permalink( get_option( 'page_for_posts' ) ) : home_url( '/' ); 512 515 $posts_page = esc_url( $posts_page ); 513 if ( 'list' == $ style )516 if ( 'list' == $r['style'] ) { 514 517 $output .= "<li class='cat-item-all'><a href='$posts_page'>$show_option_all</a></li>"; 515 else518 } else { 516 519 $output .= "<a href='$posts_page'>$show_option_all</a>"; 520 } 517 521 } 518 522 519 523 if ( empty( $r['current_category'] ) && ( is_category() || is_tax() || is_tag() ) ) { 520 524 $current_term_object = get_queried_object(); 521 if ( $current_term_object && $r['taxonomy'] === $current_term_object->taxonomy ) 525 if ( $current_term_object && $r['taxonomy'] === $current_term_object->taxonomy ) { 522 526 $r['current_category'] = get_queried_object_id(); 523 } 524 525 if ( $hierarchical ) 527 } 528 } 529 530 if ( $r['hierarchical'] ) { 526 531 $depth = $r['depth']; 527 else532 } else { 528 533 $depth = -1; // Flat. 529 534 } 530 535 $output .= walk_category_tree( $categories, $depth, $r ); 531 536 } 532 537 533 if ( $ title_li && 'list' == $style)538 if ( $r['title_li'] && 'list' == $r['style'] ) 534 539 $output .= '</ul></li>'; 535 540 … … 542 547 * @param array $args An array of taxonomy-listing arguments. 543 548 */ 544 $output = apply_filters( 'wp_list_categories', $output, $args ); 545 546 if ( $echo ) 547 echo $output; 548 else 549 return $output; 549 $html = apply_filters( 'wp_list_categories', $output, $args ); 550 551 if ( $r['echo'] ) { 552 echo $html; 553 } else { 554 return $html; 555 } 550 556 } 551 557
Note: See TracChangeset
for help on using the changeset viewer.