• Hi! I’m finally starting to get my hands around customizing wordpress and i’m having great fun with it.

    I do have one glitch that is driving me batty.

    I’m using the below code to display a sub page navigation element.

    <?php
    global $wp_query;

    if( empty($wp_query->post->post_parent) ) {
    $parent = $wp_query->post->ID;
    } else {
    $parent = $wp_query->post->post_parent;
    }

    wp_list_pages(“&sort_column=menu_order&depth=3&title_li=”);
    ?>

    It works great on every page I use it on except for one. On that one page, it displays all of the top level pages including the page its on.

    Any suggestions would be greatly appreciated.

    Thx

    Marty

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

    (@mdesilets)

    I was able to solve it with:

    <?php
    wp_list_pages("child_of=".$post->ID."&sort_column=menu_order&depth=3&title_li=");
    ?>

    but im not sure thats the best solution…

    Thread Starter mdesilets

    (@mdesilets)

    This worked even better to suit my needs!

    <?php
        wp_list_pages("child_of=".$post->post_parent."&sort_column=menu_order&depth=3&title_li=");
    
    ?>
    Thread Starter mdesilets

    (@mdesilets)

    having a great time having a conversation with myself… ultimately?

    I decided on this… as I dont want the navigation to change when visiting sub pages…

    <?php
    if($post->post_parent == 0)
    {
    wp_list_pages(“title_li=&child_of=”.$post->ID.”&show_date=modified&date_format=$date_format&location=sidebar&sort_column=menu_order”);
    }
    else
    {
    wp_list_pages(“title_li=&child_of=”.$post->post_parent.”&show_date=modified&date_format=$date_format&location=sidebar&sort_column=menu_order”);
    }
    ?>

    hopefully this will help someone

    This helped me, thanks.

    I could use some help with a similiar issue:

    I’m using this in my sidebar:

    if (is_page('about')) {
                 // our about page.
                 echo "<h1>title</h1>
                 <ol><li>Content here</li></ol>";

    I’m wondering if there’s a way to write this so that that block of content appears on the about page and any child page of the about (i.e. pages with About marked as a page parent)

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘List Child Pages’ is closed to new replies.