Support » Fixing WordPress » List sub pages – problems: displays all pages and subpages

  • Hi! I´m trying to list my subpages in the sidebar. I want to list the current page and his child pages when the page has child pages (or I am in the child page).

    There´s plenty of information of how to do that, including in the codex:

    I´m usin this code:

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

    But, when using this code, what I get is the display of all the pages with their supages.

    Any idea what´s going wrong? any suggestion?
    Anybody had the similar problem?

    I try a lot of different codes, and I´m having always the same problem, so I guess I´m doing something wrong when adding pages (my main pages has no superior, and my child pages have their respective parent page as superior, is that ok?)

    Finally, If I used any of the plugins for listing subpages it works correctly and the subpages are display as expected. However, I would like to do it without plugins, and especially, I would like to know why that code is not working for me.

    Thanks in advance!

  • The topic ‘List sub pages – problems: displays all pages and subpages’ is closed to new replies.