Support » Fixing WordPress » Displaying Grandchild pages only when on child page

  • Hello,

    I currently have 3 levels of navigation.
    I can display the parent, child and grandchild pages fine using the code form the codex (below)

    $children = wp_list_pages("title_li=&child_of=".$post->post_parent."&echo=0");
    $children = wp_list_pages("title_li=&child_of=".$post->ID."&echo=0");
    if ($children) { ?>
        <?php echo $children; ?> 
    <?php } ?>

    [Moderator Note: Please post code or markup snippets between backticks or use the code button.]

    However I want the grandchild pages to display only when I have selected the child page (see below)

    – child page 1
    – Grandchild page 1
    – Grandchild page 2
    – Grandchild page 3
    – child page 2
    – child page 3

    All child pages should still be on display when I am on a Grandchild page.

    Hope you can help.

    [closed as duplicate of: – continue with the original topic]

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘Displaying Grandchild pages only when on child page’ is closed to new replies.