Make WordPress Core

Opened 9 years ago

Closed 6 years ago

#8959 closed enhancement (wontfix)

wp_list_pages and position of current_page_item / _parent / _ancestor

Reported by: stgoos Owned by:
Milestone: Priority: normal
Severity: normal Version:
Component: Template Keywords:
Focuses: Cc:


I'm currently using the CSS only menu dropdown solution from http://cssmenus.co.uk/dropdown.html which works great but I can't style the active menu selection properly as the class elements current_page_item / _parent / _ancestor are connected to the <li> tag rather then the <a href> tag. With this you can't highlight the actual menu path because it would affect whole submenus as well...

My suggestion is to include an additional argument to the wp_list_pages function with which you can control the output location of the current_page_item / _parent / _ancestor class elements.

Defaul behaviour: the current_page_ class elements gets assigned to the <li> tag just like it happens now.

Alternative behaviour: the current_page_ class elements gets assigned to the <a href> tag to allow alternative css styling options.

This would affect the following functions / files:

  • wp_list_pages function in /wp-includes/post-template.php
  • start_el function in /wp-includes/classes.php

And probably also the wp_page_menu function in /wp-includes/post-template.php to keep that one in line with the wp_list_pages function.

Change History (7)

#1 @alexdunae
9 years ago

You should be able to do whatever styling you'd like using the class on the li tag.

Looking at the CSS on the cssmenus site, this appears to be what they're doing:

  #menu :hover ul li.currentsub

9 years ago

  • Milestone changed from 2.7.2 to 2.8

#3 @janeforshort
9 years ago

  • Milestone changed from 2.8 to Future Release

Punting due to feature freeze. Reconsider with next release.

#4 @Denis-de-Bernardy
9 years ago

  • Component changed from General to Template

#5 @Denis-de-Bernardy
9 years ago

wasn't this recently fixed in trunk?

#6 @Japh
6 years ago

  • Cc japh@… added

From what I can tell from a cursory look at the places suggested by the OP, this hasn't been "fixed" yet. However, isn't this a CSS issue that can be solved by using the pseudo class :first-child?

In which case, perhaps should be closed with 'wontfix'.

#7 @SergeyBiryukov
6 years ago

  • Milestone Future Release deleted
  • Resolution set to wontfix
  • Status changed from new to closed
Note: See TracTickets for help on using tickets.