Allow overriding cat walker. Props AaronCampbell. fixes #8682 for trunk
git-svn-id: http://svn.automattic.com/wordpress/trunk@10246 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
f368711809
commit
5aaf5ac0ad
|
@ -439,8 +439,10 @@ class Walker_Category_Checklist extends Walker {
|
||||||
* @param unknown_type $selected_cats
|
* @param unknown_type $selected_cats
|
||||||
* @param unknown_type $popular_cats
|
* @param unknown_type $popular_cats
|
||||||
*/
|
*/
|
||||||
function wp_category_checklist( $post_id = 0, $descendants_and_self = 0, $selected_cats = false, $popular_cats = false ) {
|
function wp_category_checklist( $post_id = 0, $descendants_and_self = 0, $selected_cats = false, $popular_cats = false, $walker = null ) {
|
||||||
|
if ( empty($walker) || !is_a($walker, 'Walker') )
|
||||||
$walker = new Walker_Category_Checklist;
|
$walker = new Walker_Category_Checklist;
|
||||||
|
|
||||||
$descendants_and_self = (int) $descendants_and_self;
|
$descendants_and_self = (int) $descendants_and_self;
|
||||||
|
|
||||||
$args = array();
|
$args = array();
|
||||||
|
|
|
@ -719,8 +719,13 @@ function wp_generate_tag_cloud( $tags, $args = '' ) {
|
||||||
* @see Walker_Category::walk() for parameters and return description.
|
* @see Walker_Category::walk() for parameters and return description.
|
||||||
*/
|
*/
|
||||||
function walk_category_tree() {
|
function walk_category_tree() {
|
||||||
$walker = new Walker_Category;
|
|
||||||
$args = func_get_args();
|
$args = func_get_args();
|
||||||
|
// the user's options are the third parameter
|
||||||
|
if ( empty($args[2]['walker']) || !is_a($args[2]['walker'], 'Walker') )
|
||||||
|
$walker = new Walker_Category;
|
||||||
|
else
|
||||||
|
$walker = $args[2]['walker'];
|
||||||
|
|
||||||
return call_user_func_array(array( &$walker, 'walk' ), $args );
|
return call_user_func_array(array( &$walker, 'walk' ), $args );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -732,8 +737,13 @@ function walk_category_tree() {
|
||||||
* @see Walker_CategoryDropdown::walk() for parameters and return description.
|
* @see Walker_CategoryDropdown::walk() for parameters and return description.
|
||||||
*/
|
*/
|
||||||
function walk_category_dropdown_tree() {
|
function walk_category_dropdown_tree() {
|
||||||
$walker = new Walker_CategoryDropdown;
|
|
||||||
$args = func_get_args();
|
$args = func_get_args();
|
||||||
|
// the user's options are the third parameter
|
||||||
|
if ( empty($args[2]['walker']) || !is_a($args[2]['walker'], 'Walker') )
|
||||||
|
$walker = new Walker_CategoryDropdown;
|
||||||
|
else
|
||||||
|
$walker = $args[2]['walker'];
|
||||||
|
|
||||||
return call_user_func_array(array( &$walker, 'walk' ), $args );
|
return call_user_func_array(array( &$walker, 'walk' ), $args );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue