[wp-trac] [WordPress Trac] #11338: Customer Walker initialize error
WordPress Trac
wp-trac at lists.automattic.com
Sat Dec 5 17:24:42 UTC 2009
#11338: Customer Walker initialize error
--------------------------+-------------------------------------------------
Reporter: ShaneF | Owner:
Type: defect (bug) | Status: new
Priority: high | Milestone: 2.9
Component: Formatting | Version: 2.9
Severity: major | Keywords: has-patch
--------------------------+-------------------------------------------------
While I was delvoping a customer walker for my wp_list_pages, I was having
trouble getting it to read my customer extended class of Walker_Page. I
was talking with DD32 last night and he came up with the solution..
{{{
wp_list_pages(array('walker' => 'new Walker_Page_Rabbit', 'title_li' =>
'', 'depth' => '1'));
}}}
...instead of...
{{{
wp_list_pages(array('walker' => 'Walker_Page_Rabbit', 'title_li' => '',
'depth' => '1'));
}}}
Clearly the reason for including the "new" was because in the 'category-
template.php' and 'post-template.php' had...
{{{
if ( empty($r['walker']) )
$walker = new Walker_Page;
else
$walker = $r['walker'];
}}}
I found out that having 'new' in the
{{{
$r['walker']
}}}
..caused a mismatched argument in the...
{{{
return call_user_func_array(array(&$walker, 'walk'), $args);
}}}
'new' would be passed on. Once I changed the code in the 'core' to include
the new and I would define just 'Walker_Page_Rabbit' in the 'wp_list_page'
and it worked perfectly.
{{{
if ( empty($r['walker']) )
$walker = new Walker_Page;
else
$walker = new $r['walker'];
}}}
This is a major blocker for any people who are working on customer
walkers. Attached is a patch that does work.
--
Ticket URL: <http://core.trac.wordpress.org/ticket/11338>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list