Ticket #8682: 8682.001.diff

File 8682.001.diff, 1.9 KB (added by AaronCampbell, 4 years ago)
Line 
1Index: wp-includes/category-template.php
2===================================================================
3--- wp-includes/category-template.php   (revision 10234)
4+++ wp-includes/category-template.php   (working copy)
5@@ -717,8 +717,13 @@
6  * @see Walker_Category::walk() for parameters and return description.
7  */
8 function walk_category_tree() {
9-       $walker = new Walker_Category;
10        $args = func_get_args();
11+       // the user's options are the third parameter
12+       if ( empty($args[2]['walker']) || !is_a($args[2]['walker'], 'Walker') )
13+               $walker = new Walker_Category;
14+       else
15+               $walker = $args[2]['walker'];
16+
17        return call_user_func_array(array( &$walker, 'walk' ), $args );
18 }
19 
20@@ -730,8 +735,13 @@
21  * @see Walker_CategoryDropdown::walk() for parameters and return description.
22  */
23 function walk_category_dropdown_tree() {
24-       $walker = new Walker_CategoryDropdown;
25        $args = func_get_args();
26+       // the user's options are the third parameter
27+       if ( empty($args[2]['walker']) || !is_a($args[2]['walker'], 'Walker') )
28+               $walker = new Walker_CategoryDropdown;
29+       else
30+               $walker = $args[2]['walker'];
31+
32        return call_user_func_array(array( &$walker, 'walk' ), $args );
33 }
34 
35Index: wp-admin/includes/template.php
36===================================================================
37--- wp-admin/includes/template.php      (revision 10234)
38+++ wp-admin/includes/template.php      (working copy)
39@@ -439,8 +439,10 @@
40  * @param unknown_type $selected_cats
41  * @param unknown_type $popular_cats
42  */
43-function wp_category_checklist( $post_id = 0, $descendants_and_self = 0, $selected_cats = false, $popular_cats = false ) {
44-       $walker = new Walker_Category_Checklist;
45+function wp_category_checklist( $post_id = 0, $descendants_and_self = 0, $selected_cats = false, $popular_cats = false, $walker = null ) {
46+       if ( empty($walker) || !is_a($walker, 'Walker') )
47+               $walker = new Walker_Category_Checklist;
48+
49        $descendants_and_self = (int) $descendants_and_self;
50 
51        $args = array();