WordPress.org

Make WordPress Core

Ticket #8673: post-template.php.patch

File post-template.php.patch, 1.0 KB (added by MikeLittle, 5 years ago)

Patch against rev 10226 to implement custom Walker_Page and Walker_PageDropdown

  • wp-includes/post-template.php

     
    719719 * @see Walker_Page::walk() for parameters and return description. 
    720720 */ 
    721721function walk_page_tree($pages, $depth, $current_page, $r) { 
    722         $walker = new Walker_Page; 
     722        extract( $r, EXTR_SKIP ); 
     723    if ( empty($walker) )  
     724        $walker = new Walker_Page; 
     725 
    723726        $args = array($pages, $depth, $r, $current_page); 
    724727        return call_user_func_array(array(&$walker, 'walk'), $args); 
    725728} 
     
    732735 * @see Walker_PageDropdown::walk() for parameters and return description. 
    733736 */ 
    734737function walk_page_dropdown_tree() { 
    735         $walker = new Walker_PageDropdown; 
    736738        $args = func_get_args(); 
     739    if ( empty($args[2]['walker']) ) //the user's options are the third parameter 
     740        $walker = new Walker_PageDropdown; 
     741    else 
     742        $walker = $args[2]['walker']; 
     743 
    737744        return call_user_func_array(array(&$walker, 'walk'), $args); 
    738745} 
    739746