I've got a primary page which has a children item. Now my real question is, can you really possess the Primary page link straight to the kids item inside it? E.g.

-Primary Page(links to Page 2)

---Page 2

Here's my code:

<div id="MainNav">
<ul>
<?php wp_list_pages('exclude=3&sort_column=menu_order&title_li=&depth=1'); ?>
</ul>
</div>
<div id="leftCol">
<?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 } else { ?>
<?php } ?>
</div>

Initially, it appears much like your approach should work. Can't really say more without more information regarding your problem.

As a substitute, Used to do an identical factor around the blog I maintain, but needed a little with additional control within the output. And So I wound up moving my very own function. Here's the way i made it happen:

// Generate the subnav for a page
// Returns a list of links to child pages
// if there are no children, returns a blank list
function get_subnav($page_id)
{
     $current_page = get_page($page_id);
     if ($current_page->ancestors) {
       $child = get_page($page_id);
       $ancestor_id = $child->ancestors[0];
       $page = get_page($ancestor_id);
     } else {
       $page = get_page($page_id);
     }

     $children = get_children('post_parent=' . 
            $page->ID . '&post_type=page&post_status=publish&order=ASC&orderby=menu_order');

     if ($children) {
       $html = '';
       foreach ($children as $child) {
       $html .= "<li><a href='" . get_page_link($page->ID) . "'>" . get_post_meta($page->ID, 'nav_name', true) . "</a></li>\n";
       }
     } else {
       return false;
}


return $html;

I refer to it as such as this: get_subnav($post->ID)

Observe that it will not climb the whole tree of child pages. If you are calling it from the child page, it'll construct the navigation having its first ancestor because the root node.

I do not understand.

The code you provided works together with no errors tossed (not really in debug mode). Are you currently asking in the event that works? If that's the case, yes it will. When not on your side, please inform us your specs and whereby your theme you are adding this.

Also, rather than $post->post_parent, you need to most likely use $wp_query->post->post_parent. It's safer, if someone's used custom queries and giving them a call $post informed.

I have carried this out before by developing a Page template that instantly redirects towards the first child. Possibly you could utilize that. Give a file inside your template directory known as tofirstchild.php and set this inside it:

<?php

/*
Template Name: Redirect To First Child
*/

if ( have_posts() ) {
    while ( have_posts() ) {
        the_post();
        $pagekids = get_pages( "post_parent=" . $post->ID . "&sort_column=menu_order" );
        $firstchild = $pagekids[0];
        wp_redirect( get_permalink( $firstchild->ID ) );
    }
}

?>

Then within the Admin area, choose "Redirect to First Child" template for that "About Us" page.