WordPress.org

Ready to get started?Download WordPress

Forums

Subpage list navigation on all pages under parent (4 posts)

  1. lambdachi
    Member
    Posted 7 years ago #

    I have a site that has a main horizontal navigation bar with lists the three topmost pages in my site. I have a few levels of subpages under each main page, and when I dive into one of the sections, I would like to show all of the subpages as a nested list in the sidebar. For example...

    Main navigation:

    Page ONE | Page TWO | Page THREE

    If I go to ANY page that is a subpage under Page ONE, in the sidebar I would like to show:

    PAGE ONE

    • Subpage A
      • Subpage Aa
      • Subpage Ab
      • Subpage Ac
    • Subpage B
    • Subpage C
      • Subpage Ca
      • Subpage Cb
    • Subpage D
    • Subpage E

    Any thoughts?

  2. moshu
    Member
    Posted 7 years ago #

    I've found this the other day here in the forum (by searching for display children pages and similar keywords), just don't remember where...
    <?php
    $thispage = $wp_query->post;
    if($thispage->post_parent!=0)
    {
    wp_list_pages("title_li=&child_of=".$thispage->post_parent);
    }
    else
    {
    wp_list_pages("title_li=&child_of=".$thispage->ID);
    }
    ?>

  3. Ahni
    Member
    Posted 7 years ago #

    Perfect! Thanks.

  4. kitkaplan
    Member
    Posted 7 years ago #

    I am using Regulus and having trouble with subpages. I have the same set up, a few horizontal links at top but sublevels 3 deep. Only the first level of subpages shows up and the link does not go deeper. Can I use his and where does it go? I am php illiterate.

    This is the site
    http://p10.hostingprod.com/@onespiritinterfaith.org/seminary

Topic Closed

This topic has been closed to new replies.

About this Topic