Support » Fixing WordPress » List parents and child pages of curent child page

  • Ok after I spent whole morning trying and testing various stuff I came here to cry for help. This is my situation

    Level 1
      -level 2
      -level 2
      -level 2
         -level 3
         -level 3
         -level 3
      -level 2
    Level 1
    Level 1

    Ok I want when I`m on level 3 pages to list all level 3 and level 2 pages from same level 1 parent.

    I tried with this but no luck:

    <?php
                        $output = wp_list_pages('echo=0&depth=1&title_li=');
                        if (is_page()) {
                            $page = $post->ID;
                            if ($post->post_parent) {
                                $page = $post->post_parent;
                            }
                            $children = wp_list_pages('echo=0&child_of=' . $page . '&title_li=');
                            if ($children) {
                                $output = wp_list_pages('echo=0&child_of=' . $page . '&title_li=');
                            }
                        }
                        echo $output;
                        ?>

Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘List parents and child pages of curent child page’ is closed to new replies.