Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
  • #21781

    I love the Pages Sidebar Navigation that occurs when you have nested pages. I want that to ALSO show the partent page as the “Title” of the widget and have the subpages go below that. Where would I change the code to get the Parent Page as the title or just included in that lineup?



    Hi andreanapier1985,

    You can try modifying the function in the sidebar.php file in the theme files.




    Cool, I added $parent = wp_title(”); and $sidebar_menu .= $parent; in there to get the desired effect.

    $sidebar_menu = “”;

    if($subNav && isset($post) && is_object($post) && !empty($post->ID) && is_page())


    global $post;

    $subNav = false;

    $parent = $post->ID;

    $sidebar_menu = “”;

    if (!empty($post->post_parent))


    if(isset($post->ancestors)) $ancestors = $post->ancestors;

    if(!isset($ancestors)) $ancestors = get_post_ancestors($post->ID);

    $root = count($ancestors)-1;

    $parent = $ancestors[$root];


    $children = wp_list_pages(“title_li=&child_of=”. $parent .”&echo=0″);

    $parent = wp_title(”);

    if ($children)


    $default_sidebar = false;

    $sidebar_menu .= “<div class=’widget widget_nav_menu’>”;

    $sidebar_menu .= $parent;

    $sidebar_menu .=”<ul class=’nested_nav’>”;

    $sidebar_menu .= $children;

    $sidebar_menu .= “</div>”;




    Oops, sent this before I was finished… it just spits out the title of the current page as the title, it doesn’t spit out the title of JUST the “parent” page. What should I put instead of $parent = wp_title(”); to get the title of the parent page?




    $parent = get_the_title($post->post_parent);

    Best regards,


Viewing 5 posts - 1 through 5 (of 5 total)

The topic ‘Pages Sidebar Navigation’ is closed to new replies.