Forum Replies Created

Viewing 5 replies - 1 through 5 (of 5 total)
  • Thread Starter kalikat

    (@kalikat)

    Thanks for the suggestion! I’ll give that a try. I have a funny feeling that I’ll have to input page titles manually, though.

    I’m tearing my hair out over the same issue – has anyone gotten this to work? I just can’t get WP 2.5 to recognize parent/child/grandchild pages properly.

    I need something that works likes Otto’s example above, but I get a parse error when using that exact example. It’s on line 29, which is:

    <?php global $wp_query; if( has_parent($wp_query->post), 5)) :?>

    Anyone know what I’m doing wrong?

    @roger – thanks so much!

    I’m having a bit of trouble getting the code to work. I’m still a bit confused by the $post->post_parent relationship. Basically, I want my sub-pages to show a list of their children whilst on that sub-page or on any of its children, ignoring a top-level of pages entirely.

    Page (no listing of pages)
    -Sub-page (list of all pages under this page)
    –Sub-sub-page (list of all siblings -i.e. identical to that above)

    $post->ID works on my sub-pages, but shows nothing once in the sub-sub-page and $post->post_parent works on my sub-sub-pages, but shows an entire list of my pages on the sub-page. It’s very frustrating!

    This codex example sounds like it should work:

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

    …but, again, only works once drilled down into a sub-sub-page. On a sub-page, it shows all siblings of that page and their children. It’s like I need a combination of your code and the codex example working in tandem, but I can’t seem to make the thing work at all!

    RogerTheriault: is there any way to modify that code (which works perfectly for me!) to display the same information on the child pages also?

    Thread Starter kalikat

    (@kalikat)

    Still no joy with this unfortunately, and I’m tearing my hair out. I want something like the codex example, but for the current page (which is a child of another page), and grandchildren of that current page:

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

    This works fine when I’m actually on the grandchild pages, but when on the parent of my child pages (‘current’ page in the outline below), it give me a list of all pages as follows:

    Top-Level Page
    – Current Page
    –Child of current page
    –Child of current page
    Another Top-Level Page
    – Child
    –Grandchild
    –Grandchild

    When I need:

    Current Page
    –Child of current page
    –Child of current page

    I’m using the same template for my child and grandchild pages – shouldn’t this work? I assumed that the current page wold be considered the parent page, irregardless of whether it’s a child of another, top-level, page. Or am I misunderstanding how this works?

    I’d greatly appreciate any help!

Viewing 5 replies - 1 through 5 (of 5 total)