Ticket #7251: subcat-separator.diff
| File subcat-separator.diff, 2.7 KB (added by nbachiyski, 4 years ago) |
|---|
-
wp-includes/category-template.php
109 109 return $category->name; 110 110 } 111 111 112 function get_the_category_list($separator = '', $parents='', $post_id = false ) {112 function get_the_category_list($separator = '', $parents='', $post_id = false, $subcat_separator = '/') { 113 113 global $wp_rewrite; 114 114 $categories = get_the_category($post_id); 115 115 if (empty($categories)) … … 125 125 switch ( strtolower($parents) ) { 126 126 case 'multiple': 127 127 if ($category->parent) 128 $thelist .= get_category_parents($category->parent, TRUE );128 $thelist .= get_category_parents($category->parent, TRUE, $subcat_separator); 129 129 $thelist .= '<a href="' . get_category_link($category->term_id) . '" title="' . sprintf(__("View all posts in %s"), $category->name) . '" ' . $rel . '>' . $category->name.'</a></li>'; 130 130 break; 131 131 case 'single': 132 132 $thelist .= '<a href="' . get_category_link($category->term_id) . '" title="' . sprintf(__("View all posts in %s"), $category->name) . '" ' . $rel . '>'; 133 133 if ($category->parent) 134 $thelist .= get_category_parents($category->parent, FALSE );134 $thelist .= get_category_parents($category->parent, FALSE, $subcat_separator); 135 135 $thelist .= $category->name.'</a></li>'; 136 136 break; 137 137 case '': … … 148 148 switch ( strtolower($parents) ) { 149 149 case 'multiple': 150 150 if ( $category->parent ) 151 $thelist .= get_category_parents($category->parent, TRUE );151 $thelist .= get_category_parents($category->parent, TRUE, $subcat_separator); 152 152 $thelist .= '<a href="' . get_category_link($category->term_id) . '" title="' . sprintf(__("View all posts in %s"), $category->name) . '" ' . $rel . '>' . $category->cat_name.'</a>'; 153 153 break; 154 154 case 'single': 155 155 $thelist .= '<a href="' . get_category_link($category->term_id) . '" title="' . sprintf(__("View all posts in %s"), $category->name) . '" ' . $rel . '>'; 156 156 if ( $category->parent ) 157 $thelist .= get_category_parents($category->parent, FALSE );157 $thelist .= get_category_parents($category->parent, FALSE, $subcat_separator); 158 158 $thelist .= "$category->cat_name</a>"; 159 159 break; 160 160 case '': … … 201 201 return false; 202 202 } 203 203 204 function the_category($separator = '', $parents='', $post_id = false ) {205 echo get_the_category_list($separator, $parents, $post_id );204 function the_category($separator = '', $parents='', $post_id = false, $subcat_separator='/') { 205 echo get_the_category_list($separator, $parents, $post_id, $subcat_separator); 206 206 } 207 207 208 208 function category_description($category = 0) {
