WordPress.org

Make WordPress Core

Changeset 10246


Ignore:
Timestamp:
12/23/2008 12:52:37 PM (9 years ago)
Author:
ryan
Message:

Allow overriding cat walker. Props AaronCampbell. fixes #8682 for trunk

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/includes/template.php

    r10239 r10246  
    440440 * @param unknown_type $popular_cats
    441441 */
    442 function wp_category_checklist( $post_id = 0, $descendants_and_self = 0, $selected_cats = false, $popular_cats = false ) {
    443     $walker = new Walker_Category_Checklist;
     442function wp_category_checklist( $post_id = 0, $descendants_and_self = 0, $selected_cats = false, $popular_cats = false, $walker = null ) {
     443    if ( empty($walker) || !is_a($walker, 'Walker') )
     444        $walker = new Walker_Category_Checklist;
     445
    444446    $descendants_and_self = (int) $descendants_and_self;
    445447
  • trunk/wp-includes/category-template.php

    r10243 r10246  
    720720 */
    721721function walk_category_tree() {
    722     $walker = new Walker_Category;
    723722    $args = func_get_args();
     723    // the user's options are the third parameter
     724    if ( empty($args[2]['walker']) || !is_a($args[2]['walker'], 'Walker') )
     725        $walker = new Walker_Category;
     726    else
     727        $walker = $args[2]['walker'];
     728
    724729    return call_user_func_array(array( &$walker, 'walk' ), $args );
    725730}
     
    733738 */
    734739function walk_category_dropdown_tree() {
    735     $walker = new Walker_CategoryDropdown;
    736740    $args = func_get_args();
     741    // the user's options are the third parameter
     742    if ( empty($args[2]['walker']) || !is_a($args[2]['walker'], 'Walker') )
     743        $walker = new Walker_CategoryDropdown;
     744    else
     745        $walker = $args[2]['walker'];
     746
    737747    return call_user_func_array(array( &$walker, 'walk' ), $args );
    738748}
Note: See TracChangeset for help on using the changeset viewer.