Make WordPress Core

Opened 15 years ago

Closed 14 years ago

#10916 closed enhancement (wontfix)

Add filter hooks to page_menu/list_pages hyperlinks

Reported by: sam_a's profile Sam_a Owned by:
Milestone: Priority: normal
Severity: normal Version: 2.8.4
Component: General Keywords: has-patch tested
Focuses: Cc:


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.

Attachments (1)

classes_list_page_filters.diff (1.8 KB) - added by Sam_a 15 years ago.
Adds 'page_anchor_contents' and 'page_anchor_attributes' filter hooks to Walker_Page class

Download all attachments as: .zip

Change History (2)

15 years ago

Adds 'page_anchor_contents' and 'page_anchor_attributes' filter hooks to Walker_Page class

#1 @Denis-de-Bernardy
14 years ago

  • Milestone Unassigned deleted
  • Resolution set to wontfix
  • Status changed from new to closed

3.0 introduces menus

Note: See TracTickets for help on using tickets.