• Resolved baszer

    (@baszer)


    Hello,

    I am having some problems with my subnavigation.
    I want that my subnavigation only showes one level of children.

    At the head I have the parents.
    At the sidebar i have the childrens per parent.

    When one child has more children i dont want them showed.
    But when you click on one child (with more children) then all the children needs to be showed at the sidebar.

    I can show one depth but thats not good enough (than i miss other depths when clicked).

Viewing 8 replies - 1 through 8 (of 8 total)
  • MichaelH

    (@michaelh)

    Try some of the examples listed in the wp_list_pages() article.

    Thread Starter baszer

    (@baszer)

    i did try!

    i can get only show 1 depth (but then you can’t show the children at all)

    but i searched and searched around the web and over the fora and i can’t get it solved. I hope it is even possible.

    I still hope somebody can give me the golden hint 🙂

    MichaelH

    (@michaelh)

    Didn’t test this:

    For use in sidebar, display only top level Pages, but when viewing a Page that has children (or is a child) show only children of that parent
    When visiting main page, all top level pages are listed in the sidebar.
    When click on a top level page with no children, all top level pages are listed.
    When click on a top level page with children, just the children pages are listed.
    When click on a children page, just the children of that parent are listed.

    <?php
    global $post;
    $output = wp_list_pages('echo=0&depth=1&title_li=<h2>Top Level Pages </h2>' );
    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=<h2>Child Pages</h2>');
      }
    }
    echo $output;
    ?>

    Thread Starter baszer

    (@baszer)

    your description is exact what i need! 🙂

    but i want to have the top levels at the top of the page, and the children at the sidebar. Is this script easy to cut? (in different divs)

    I can’t test it yet. (at work now) But thank you for helping me, in 2 hours you hear if its working!

    thank you!

    Thread Starter baszer

    (@baszer)

    i just tested it.

    it still doesnt work as it should. (http://www.ruunerwold.nl/bas/vissen left under is your navigation)

    it works for some parts but not for head2, than you still see the subsubpages

    MichaelH

    (@michaelh)

    Sorry–maybe someone else can spot the problem.

    Thread Starter baszer

    (@baszer)

    ok, thank u for trying!

    hopefully someone else knows how to solve the problem?

    Thread Starter baszer

    (@baszer)

    FINALLY!

    I’ve got it!

    for other users with the same problem:
    http://rider.sofarider.com/blog/wordpress-tips/how-to-build-sequential-navigation-in-wordpress/

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Show only one depth, not all childs’ is closed to new replies.