Ticket #7251: subcat-separator.diff

File subcat-separator.diff, 2.7 KB (added by nbachiyski, 5 years ago)
Line 
1Index: wp-includes/category-template.php
2===================================================================
3--- wp-includes/category-template.php   (revision 8259)
4+++ wp-includes/category-template.php   (working copy)
5@@ -109,7 +109,7 @@
6        return $category->name;
7 }
8 
9-function get_the_category_list($separator = '', $parents='', $post_id = false) {
10+function get_the_category_list($separator = '', $parents='', $post_id = false, $subcat_separator = '/') {
11        global $wp_rewrite;
12        $categories = get_the_category($post_id);
13        if (empty($categories))
14@@ -125,13 +125,13 @@
15                        switch ( strtolower($parents) ) {
16                                case 'multiple':
17                                        if ($category->parent)
18-                                               $thelist .= get_category_parents($category->parent, TRUE);
19+                                               $thelist .= get_category_parents($category->parent, TRUE, $subcat_separator);
20                                        $thelist .= '<a href="' . get_category_link($category->term_id) . '" title="' . sprintf(__("View all posts in %s"), $category->name) . '" ' . $rel . '>' . $category->name.'</a></li>';
21                                        break;
22                                case 'single':
23                                        $thelist .= '<a href="' . get_category_link($category->term_id) . '" title="' . sprintf(__("View all posts in %s"), $category->name) . '" ' . $rel . '>';
24                                        if ($category->parent)
25-                                               $thelist .= get_category_parents($category->parent, FALSE);
26+                                               $thelist .= get_category_parents($category->parent, FALSE, $subcat_separator);
27                                        $thelist .= $category->name.'</a></li>';
28                                        break;
29                                case '':
30@@ -148,13 +148,13 @@
31                        switch ( strtolower($parents) ) {
32                                case 'multiple':
33                                        if ( $category->parent )
34-                                               $thelist .= get_category_parents($category->parent, TRUE);
35+                                               $thelist .= get_category_parents($category->parent, TRUE, $subcat_separator);
36                                        $thelist .= '<a href="' . get_category_link($category->term_id) . '" title="' . sprintf(__("View all posts in %s"), $category->name) . '" ' . $rel . '>' . $category->cat_name.'</a>';
37                                        break;
38                                case 'single':
39                                        $thelist .= '<a href="' . get_category_link($category->term_id) . '" title="' . sprintf(__("View all posts in %s"), $category->name) . '" ' . $rel . '>';
40                                        if ( $category->parent )
41-                                               $thelist .= get_category_parents($category->parent, FALSE);
42+                                               $thelist .= get_category_parents($category->parent, FALSE, $subcat_separator);
43                                        $thelist .= "$category->cat_name</a>";
44                                        break;
45                                case '':
46@@ -201,8 +201,8 @@
47                return false;
48 }
49 
50-function the_category($separator = '', $parents='', $post_id = false) {
51-       echo get_the_category_list($separator, $parents, $post_id);
52+function the_category($separator = '', $parents='', $post_id = false, $subcat_separator='/') {
53+       echo get_the_category_list($separator, $parents, $post_id, $subcat_separator);
54 }
55 
56 function category_description($category = 0) {