| 1 | Index: wp-includes/category-template.php |
|---|
| 2 | =================================================================== |
|---|
| 3 | --- wp-includes/category-template.php (revision 15490) |
|---|
| 4 | +++ wp-includes/category-template.php (working copy) |
|---|
| 5 | @@ -453,13 +453,17 @@ |
|---|
| 6 | $defaults = array( |
|---|
| 7 | 'show_option_all' => '', 'show_option_none' => __('No categories'), |
|---|
| 8 | 'orderby' => 'name', 'order' => 'ASC', |
|---|
| 9 | - 'show_last_update' => 0, 'style' => 'list', |
|---|
| 10 | + 'show_last_update' => 0, |
|---|
| 11 | 'show_count' => 0, 'hide_empty' => 1, |
|---|
| 12 | 'use_desc_for_title' => 1, 'child_of' => 0, |
|---|
| 13 | 'feed' => '', 'feed_type' => '', |
|---|
| 14 | 'feed_image' => '', 'exclude' => '', |
|---|
| 15 | 'exclude_tree' => '', 'current_category' => 0, |
|---|
| 16 | 'hierarchical' => true, 'title_li' => __( 'Categories' ), |
|---|
| 17 | + 'list_before' => '<li class="%class">', 'list_after' => '</li>', |
|---|
| 18 | + 'categories_before' => '<ul>', 'categories_after' => '</ul>', |
|---|
| 19 | + 'element_before' => '<li>', 'element_after' => '</li>', |
|---|
| 20 | + 'title_before' => '', 'title_after' => '', |
|---|
| 21 | 'echo' => 1, 'depth' => 0, |
|---|
| 22 | 'taxonomy' => 'category' |
|---|
| 23 | ); |
|---|
| 24 | @@ -488,24 +492,19 @@ |
|---|
| 25 | $categories = get_categories( $r ); |
|---|
| 26 | |
|---|
| 27 | $output = ''; |
|---|
| 28 | - if ( $title_li && 'list' == $style ) |
|---|
| 29 | - $output = '<li class="' . $class . '">' . $title_li . '<ul>'; |
|---|
| 30 | - |
|---|
| 31 | + |
|---|
| 32 | + if ( !empty( $title_li ) ) |
|---|
| 33 | + $output .= str_replace( '%class', $class, $list_before ) . $title_before . $title_li . $title_after . $categories_before; |
|---|
| 34 | + |
|---|
| 35 | if ( empty( $categories ) ) { |
|---|
| 36 | if ( ! empty( $show_option_none ) ) { |
|---|
| 37 | - if ( 'list' == $style ) |
|---|
| 38 | - $output .= '<li>' . $show_option_none . '</li>'; |
|---|
| 39 | - else |
|---|
| 40 | - $output .= $show_option_none; |
|---|
| 41 | + $output .= $element_before . $show_option_none . $element_after; |
|---|
| 42 | } |
|---|
| 43 | } else { |
|---|
| 44 | global $wp_query; |
|---|
| 45 | |
|---|
| 46 | if( !empty( $show_option_all ) ) |
|---|
| 47 | - if ( 'list' == $style ) |
|---|
| 48 | - $output .= '<li><a href="' . get_bloginfo( 'url' ) . '">' . $show_option_all . '</a></li>'; |
|---|
| 49 | - else |
|---|
| 50 | - $output .= '<a href="' . get_bloginfo( 'url' ) . '">' . $show_option_all . '</a>'; |
|---|
| 51 | + $output .= $element_before . '<a href="' . get_bloginfo( 'url' ) . '">' . $show_option_all . '</a>' . $element_after; |
|---|
| 52 | |
|---|
| 53 | if ( empty( $r['current_category'] ) && ( is_category() || is_tax() ) ) |
|---|
| 54 | $r['current_category'] = $wp_query->get_queried_object_id(); |
|---|
| 55 | @@ -518,8 +517,8 @@ |
|---|
| 56 | $output .= walk_category_tree( $categories, $depth, $r ); |
|---|
| 57 | } |
|---|
| 58 | |
|---|
| 59 | - if ( $title_li && 'list' == $style ) |
|---|
| 60 | - $output .= '</ul></li>'; |
|---|
| 61 | + if ( !empty( $title_li ) ) |
|---|
| 62 | + $output .= $categories_after . $list_after; |
|---|
| 63 | |
|---|
| 64 | $output = apply_filters( 'wp_list_categories', $output, $args ); |
|---|
| 65 | |
|---|