[wp-hackers] Modifying wp_list_pages() from a plugin

Pete Holiday pete.holiday at gmail.com
Wed Jan 5 23:28:50 UTC 2011


The wp_list_pages filter is applied to the HTML after it's generated, which
would require me to a) query MySQL to see if the user has any private pages
to display, b) parse the HTML to determine the format, c) insert the
appropriate HTML in the right place. If that's the only solution, I suppose
that's better than nothing, but I'm not sure how reliably the HTML could
really be parsed into the values passed into the method.

Philip: that's a good work-around for the most common use-case, I think, but
I've had folks emailing me about all sorts of creative uses of wp_list_pages
(header nav bars, dropdown menus, bizarre ajaxy things, etc.) so I'd like to
avoid that route as the official solution.

If there's not an action or hook that does this, it appears that the best
option is creating a wrapper function that runs a MySQL query to determine
the exact list of pages to display and then passes those IDs to
wp_list_pages in the include field, and returns the result from
wp_list_pages. That'd require my users to modify their templates, so I was
hoping there was a new hook or action (or some clever php trick I was
missing).





On Wed, Jan 5, 2011 at 5:47 PM, Lazyest Hacker <lazyest at brimosoft.nl> wrote:

> Hello Pete,
>
> I don't understand why you can't use the 'wp_list_pages' filter.
>
> Marcel
>
> >> -- I'd like to just inject pages into the wp_list_pages() results myself
> from the plugin -- but I'm open to any clever solution.
>
> Thanks
>
> Pete Holiday
> _______________________________________________
> 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