atticus Posted July 10, 2008 Share Posted July 10, 2008 Hi all, I want my child pages on wordpress to only show when the parent or child page is clicked on. The problem is that when the parent page is clicked on, wordpress adds the child page under the whole list instead of directly under the parent page. <h2>Pages</h2> <ul> <?php wp_list_pages('depth=1&sort_column=menu_order&title_li='); ?> <?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 } ?> </ul> Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.