[wp-trac] [WordPress Trac] #10916: Add filter hooks to page_menu/list_pages hyperlinks
WordPress Trac
wp-trac at lists.automattic.com
Tue Oct 6 16:42:35 UTC 2009
#10916: Add filter hooks to page_menu/list_pages hyperlinks
-------------------------+--------------------------------------------------
Reporter: Sam_a | Owner:
Type: enhancement | Status: new
Priority: normal | Milestone: Unassigned
Component: General | Version: 2.8.4
Severity: normal | Keywords: has-patch tested
-------------------------+--------------------------------------------------
Patch adds 2 new filter hooks, `page_anchor_contents`, and
`page_anchor_attributes`, to let plugin/theme authors filter the
hyperlinks printed by `wp_page_menu()` and `wp_list_pages()` --
substituting a menu label different from the Page's title, changing the
title attribute, or adding new attributes, for example.
It's possible to do this now by reading the whole output from the
`wp_list_pages filter`, using regexp to find the Page you want, retrieving
the post data, and then doing a regexp replace, but we can make it a lot
simpler.
The new hooks follow the existing `page_css_class` filter hook and pass
the current $page object to the filter function, so per-page filtering is
super easy.
Tested successfully in 2.8.4 and trunk.
--
Ticket URL: <http://core.trac.wordpress.org/ticket/10916>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list