• Does anyone know how to display a list of pages like it’s done on this site (regular html):

    https://www.pharmacybenefitconsultants.com/index.htm

    It just shows the top level pages when on the homepage, and only shows the subpages if you’re on one of those particular subpages. I was thinking of using the wp_list_pages template tag and modifying depth using conditional statements to get something like:

    <?php wp_list_pages('sort_column=menu_order&exclude=3&depth=1&title_li=' . __(' ') . '' ); ?>

    for the homepage, and:

    <?php wp_list_pages('sort_column=menu_order&exclude=3&depth=2&title_li=' . __(' ') . '' ); ?>

    For all the other pages, but the problem is if I am in a subpage in a particular section, it’ll expand the subsections from all the other sections.

    Anyways I was just wondering if anyone knew of a plugin or some php I could use to get that to happen.

    Edit: something like this (https://www.ads-software.com/support/topic/96827), but the all the pages show up, and the subpages show up underneath the main page.

    Edit: I also looked through all the search results for “display child pages” but couldn’t find anything that displays both the pages and the subpages, but the subpages only when you’re on that specific subpage.

Viewing 2 replies - 1 through 2 (of 2 total)
  • I’m looking for this too. I’m trying to display only top level pages AND pages that are either children of the current page, or children of the ancestors of the current page. So, if I have a page structure like this:
    A
    > R
    > > U
    > > > X
    > > > Y
    > > > Z
    > > V
    > > W
    > S
    > T
    B
    > P
    C
    > Q
    D
    E
    F

    On the main page, I’d like to display all the top level pages: A, B, C, D, E, F

    On page ‘A’ I would like to display:
    A
    > R
    > S
    > T
    B
    C
    D
    E
    F

    On page ‘R’ I would like to display:
    A
    > R
    > > U
    > > V
    > > W
    > S
    > T
    B
    C
    D
    E
    F

    On page ‘U’ I would like to display:
    A
    > R
    > > U
    > > > X
    > > > Y
    > > > Z
    > > V
    > > W
    > S
    > T
    B
    C
    D
    E
    F

    Basically, it would be like an expanding tree, but it would not use javascript, it would simply build the menu based on the current page. It seems like this would be a common desire. Is there something like this out there, or some simple way of doing it?

    First I wrote a WordPress Plugin for this, but then it was included in the core in WordPress 2.5. However, the CSS on that page will still allow you to use the classes that were added to hide pages.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Wp_list_pages Menu’ is closed to new replies.