Opened 16 years ago
Closed 16 years ago
#8673 closed enhancement (fixed)
Missing capability to override Walker_Page
Reported by: |
|
Owned by: | |
---|---|---|---|
Milestone: | 2.8 | Priority: | normal |
Severity: | normal | Version: | 2.7 |
Component: | Template | Keywords: | has-patch |
Focuses: | Cc: |
Description ¶
Summery: PATCH to add the ability to override Walker_Page and Walker_PageDropdown.
I noticed that unlike the Comment Walker which can be overridden by a user supplied object, there is no way to override the page walker (Walker_Page) or the dropdown page walker (Walker_PageDropdown).
Attached is a patch which adds the ability to supply your own walker objects to both functions.
It uses the same method as for Walker_Comment (a instantiated class supplied to the wp_list_pages() or wp_dropdown_pages() function call.
Note: The method of checking for the added parameters was different for wp_dropdown_pages(), for some reason it does not pass the (fixed) parameters to walk_page_dropdown_tree() unlike those passed to walk_page_tree().
Pull Requests
- Loading…
Change History (5)
#1
@
16 years ago
Here is a trivial example of using the new capability.
Add the attachment add-to-functions.php to functions.php in your theme. Add the following calls in your sidebar.
<?php wp_list_pages(array('title_li'=>'<h2>Pages</h2>', 'walker' => new zed1ExamplePageWalker) ); ?>
<?php wp_dropdown_pages(array('title_li'=>'<h2>Pages</h2>', 'walker' => new zed1ExampleDropdownPageWalker) ); ?>
Patch against rev 10226 to implement custom Walker_Page and Walker_PageDropdown