WordPress.org

Make WordPress Core

Opened 8 years ago

Closed 7 years ago

#3253 closed defect (bug) (fixed)

Give parnent of current page/category a CSS class

Reported by: mdawaffe Owned by: markjaquith
Milestone: 2.1 Priority: high
Severity: normal Version: 2.1
Component: Template Keywords:
Focuses: Cc:

Description

Attached gives current_page_parent and current-cat-parent to the parent of the current object in wp_list_pages() and wp_list_categories().

Attachments (1)

3253.diff (1.3 KB) - added by mdawaffe 8 years ago.

Download all attachments as: .zip

Change History (7)

mdawaffe8 years ago

comment:1 markjaquith8 years ago

Recommend that dashes be usedin class names and IDs where ever possible: current-page-parent

http://developer.mozilla.org/en/docs/Underscores_in_class_and_ID_Names

comment:2 mdawaffe8 years ago

I agree, but we're already using current_page; I went for current_page_parent for the sake of parallelism. It'd be very confusing to people if one were one way and the other were the other.

How about we give the current page both current_page and current-page and give the parent just current-page-parent?

comment:3 markjaquith8 years ago

That'll break some plugins, unfortunately, that are filtering wp_list_pages. Of course, it wouldn't be the first time that the CSS classes for pages was changed... I think it changed in 2.0

comment:4 markjaquith7 years ago

  • Owner changed from anonymous to markjaquith
  • Status changed from new to assigned

Should probably pass by reference for get_page() and get_category

Let's stick with the underscore... I don't like them being different and changing them to dashes would break countless themes and plugins.

comment:5 matt7 years ago

  • Priority changed from normal to high

comment:6 ryan7 years ago

  • Resolution set to fixed
  • Status changed from assigned to closed

(In [4576]) Give CSS class to parent of current page/cat. Props mdawaffe. fixes #3253

Note: See TracTickets for help on using tickets.