Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I have a page that is not linked in my custom menu. This page has a parent page, which is linked in the custom menu.

If I go to the "not-linked" page, I want to to highlight it's parent page link in the menu.

I use WordPress 3.0 and there is a possibility to create a custom menu (drag-and-drop - Appearance > Menus).

The custom menu uses a list for menu styling and I would like to add a class to the parent Page link within the <li>. I also have pages with two, and top level parents.

share|improve this question

1 Answer 1

WordPress already applies the CSS class current-page-ancestor to the <li> if it is a link to a Page that is a parent (or higher) of the current Page. This follows the Page structure, not the menu structure. If this is not fit for your situation, could you edit your question to make it more clear how it differs?

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.