• WordPress: 2.6.5
    Plugins: Fluter, Gento, Maintenance Mode, pageMash, Role Manager, Simple Image Widget, Table of Contents Generator, WordPress Automatic Upgrade

    I am attempting to list the immediate children of a page in the sidebar. So I am using:

    $children = wp_list_pages('title_li=&child_of=' . $post->ID . '&depth=1&echo=0');

    And it has been working wonderfully. Now bare with me as I try and give you as much info as possible. I now have a tree of pages that is 3 levels deep.

    Page One
    - Page One child 1
    - Page One child 2
    -- Page One child 2.1
    -- Page One child 2.2
    -- Page One child 2.3
    - Page One child 3
    -- Page One child 3.1
    - Page One child 4
    - Page One child 5

    I hope this is all clear! The problem is now the wp_list_pages function above will only display “* Page One child 3.1“. If I delete “Page One child 3” (or at least make it a child of another, unrelated page) Then the wp_list_pages function Displays:

    * Page One child 2.1
    * Page One child 2.2
    * Page One child 2.3

    Each of these is incorrect as it should be displaying:

    * Page One child 1
    * Page One child 2
    * Page One child 3
    * Page One child 4
    * Page One child 5

    So it appears that it is displaying only the deepest child pages in the tree. Thats problem one, but what complicates this is that this structure:

    Page Two
    - Page Two child 1
    -- Page Two child 1.1
    - Page Two child 2
    - Page Two child 3

    Works just fine and displays the expected:

    * Page Two child 1
    * Page Two child 2
    * Page Two child 3

    If you can help me get to the bottom of this I would be very grateful, this is really bugging me!

    If I can clarify anything please ask.

    Thanks so much.

Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘wp_list_pages only displaying deepest child’ is closed to new replies.