Support » Requests and Feedback » wp_list_pages() idea

  • I’ve noticed that while using this code:


    and I’m viewing a level 2 Page, no list item gets the current_page_item class. Now of course this makes sense as the Page I’m viewing doesn’t get listed in the output.

    However I was thinking that wp_list_pages() should have an option (or perhaps do it by defualt) that the current Page’s closest relative (i.e. a parent) should get the class current_page_item if the current Page’s depth is more than the depth set in the function.

    Can anyone think of any drawbacks to this or why it shouldn’t be done? Thought I’d get a bit of a discussion on this before I made a patch and submitted a ticket.

Viewing 5 replies - 1 through 5 (of 5 total)
  • That would be perfect; it is exactly what I have been looking for! This would make it much easier to use WordPress as a CMS. I know that for example a lot of people who are using ‘tab’ navigation in the header would like the parent tab to remain highlighted when visiting a sub-page.

    Here you can find an example where this functionality would be very useful: On this page the ‘Locaties’ tab is highlighted, but when entering a sub-page such as ‘Het Hart van Weesp’, the ‘Locaties’ tab is no longer highlighted. Even though I have the parent page name in the sidebar, this not very user friendly.

    I am not the only one who needs this:

    Here is an example of a site that has succeeded in making the menu’s work:
    And this is how he did it:

    A patch or plugin would be very, very welcome!

    I think I’ll make it as a plugin and then the developers are welcome to include it in the main source if they wish. 🙂


    The Fold Page List plugin provides such functionality up through the page call hierarchy… using current_page_item for the current page, and current_page_ancestor on all ancestors (parental generations) up the hierarchy.

    THis allows for complete styling all the way up the tree, but also allows the current page to be handled differently, if required.

    The plugin works like wp_list_pages, and accepts all standard arguments of that plugin… think of it as wp_list_pages on steroids!!

    The plugin is compatible with WP 2.0, though there is a conflict with the static home page plugin that both authors are aware of.

    Hope this helps


    Awesome! Saves me a bunch of time having to make a plugin. Thanks. 🙂



    Yes indeed. Awesome! Thank you kindly!

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘wp_list_pages() idea’ is closed to new replies.