[wp-hackers] Dynamic walkers?

John Blackbourn johnbillion+wp at gmail.com
Thu Jan 29 18:36:22 GMT 2009


Hey Brian,

This is a pet peeve of mine and I've regularly written wrapper
functions for wp_list_pages() and new walker classes. Just out of
curiosity, how does your plugin change how pages are listed?

John.

2009/1/29 Bryan Fordham <bfordham at gmail.com>:
> well, that was easy. Thanks, Mike
>
> --B
>
> On Thu, Jan 29, 2009 at 11:34 AM, Mike Little <mike at zed1.com> wrote:
>> 2009/1/29 Bryan Fordham <bfordham at gmail.com>:
>>> So last night I wrote a simple plugin for a friend to modify how WP
>>> displays pages. What I ended up doing was subclassing Walker_Page and
>>> modifying walk().
>>>
>>> I wanted him to still be able to use all the options from
>>> wp_list_pages, but to do that I had to duplicate that method, instead
>>> of calling walk_page_tree it called a function just like it, only one
>>> that used my Walker class.
>>>
>>> Hope that makes sense.
>>>
>>> Anyway, my question is: would it be worthwhile to patch wp_get_pages
>>> to accept a custom Walker class? That would have kept me from
>>> duplicating code, and help avoid all the problems that entails.
>>>
>>> I'm not much of a WP hacker, so this may be a bad idea, or totally
>>> unnecessary, but if it's useful I can submit a patch.
>>>
>>> Thanks
>>> --B
>>
>>
>> Next version will support it.
>>
>> http://trac.wordpress.org/changeset/10230
>>
>>
>> Mike
>> --
>> Mike Little
>> http://zed1.com/
>> _______________________________________________
>> wp-hackers mailing list
>> wp-hackers at lists.automattic.com
>> http://lists.automattic.com/mailman/listinfo/wp-hackers
>>
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers
>


More information about the wp-hackers mailing list