Make WordPress Core

Opened 13 years ago

Closed 13 years ago

#17727 closed enhancement (fixed)

page_css_class - pass additional parameters to filter

Reported by: thedeadmedic's profile TheDeadMedic Owned by: nacin's profile nacin
Milestone: 3.3 Priority: normal
Severity: minor Version:
Component: Template Keywords: has-patch
Focuses: Cc:


Brought to light in a question asked WordPress Answers.SE, the task was to add a class parent to all pages that had children.

The solution was to extend Walker_Page, and then call the parent method, so as to have access to the arguments passed to it.

It would've been a lot easier if the filter page_css_class also passed these arguments, namely $args and $depth.

With this in place, I can see it opening up a realm of possibilities for custom CSS classes with ease!

Attachments (1)

post-template.php.diff (756 bytes) - added by TheDeadMedic 13 years ago.

Download all attachments as: .zip

Change History (6)

#1 @TheDeadMedic
13 years ago

  • Type changed from enhancement to feature request

#2 @nacin
13 years ago

  • Keywords needs-patch added
  • Milestone changed from Awaiting Review to Future Release

Filters -- and arguments added to a filter -- are not feature requests.

Please provide a patch. This seems fine for 3.3.

#3 @TheDeadMedic
13 years ago

  • Keywords has-patch added; needs-patch removed
  • Type changed from feature request to enhancement

Patch provided. Apologies @nacin, originally set as enhancement, then I panicked and thought otherwise. Have since read codex on ticket types.

All method arguments are now passed to the filter, in the same order.

Last edited 13 years ago by TheDeadMedic (previous) (diff)

#4 @SergeyBiryukov
13 years ago

  • Milestone changed from Future Release to 3.3

#5 @nacin
13 years ago

  • Owner set to nacin
  • Resolution set to fixed
  • Status changed from new to closed

In [19240]:

Pass remaining start_el() arguments to page_css_class. props TheDeadMedic, fixes #17727.

Note: See TracTickets for help on using tickets.