Support » Plugins and Hacks » Hacks » Conditional page link display question

  • Resolved he3r0

    (@he3r0)


    I have a puzzle that i cant solve,
    im using twentyten theme im modyfinyg,
    and among other things, I moved sidebar to the left,
    removed nav bar from under the banner, and moved nav
    controls as a widget with pages onto sidebar.

    now after that brief introduction, there is a question:

    in the sidebar i have listed 6 pages,
    but one of the pages have 5 child pages,
    all pages are displayed on the sidebar, including child pages, no matter what page is active. what and where i should modify to get child pages visible only when parent page link is active?

Viewing 3 replies - 1 through 3 (of 3 total)
  • I don’t think it is possible without writing a custom plugin. The widget uses wp_list_pages to generate the page list. There is a ‘depth’ parameter that controls whether child pages are visible, but that is a simple “all or nothing” toggle, it cannot be used to display only child pages of the active page.

    That said, I have already written a plugin that modifies the output of wp_list_pages, and most of that code could be reused to solve this problem. I’ll see about possibly tackling this as a separate plugin project.

    I think there are already a few plugins that do what you ask.

    One such plugin is the flexi pages widget.
    http://wordpress.org/extend/plugins/flexi-pages-widget/

    Hope that helps.

    Ah yes, looks like Flexi Pages will do exactly what the OP wants. All he has to do is select ‘Only related sub-pages’ in the widget options. I’ll not reinvent the wheel then. 🙂

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Conditional page link display question’ is closed to new replies.