[resolved] Conditional page link display question (4 posts)

  1. he3r0
    Posted 5 years ago #

    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?

  2. ambrosite
    Posted 5 years ago #

    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.

  3. Mark / t31os

    Posted 5 years ago #

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

    One such plugin is the flexi pages widget.

    Hope that helps.

  4. ambrosite
    Posted 5 years ago #

    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. :)

Topic Closed

This topic has been closed to new replies.

About this Topic


No tags yet.