Support » Fixing WordPress » List Child Pages

  • 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.

    global $wp_query;

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


    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.



Viewing 5 replies - 1 through 5 (of 5 total)
  • I was able to solve it with:


    but im not sure thats the best solution…

    This worked even better to suit my needs!


    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…

    if($post->post_parent == 0)

    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.