Modifing sidebar menu – wp list pages
-
Found this code on codex for sidebar menu. Works almost perfect, except of one thing: When visiting a child page, just the children, and descendant pages, of that parent, are listed.
All other top level pages disappear from the menu, I want them to be shown.<?php if($post->post_parent) { $children = wp_list_pages("title_li=&child_of=".$post->post_parent."&echo=0"); $titlenamer = get_the_title($post->post_parent); } else { $children = wp_list_pages("title_li=&child_of=".$post->ID."&echo=0"); $titlenamer = get_the_title($post->ID); } if ($children) { ?> <h2> <?php echo $titlenamer; ?> </h2> <ul> <?php echo $children; ?> </ul> <?php } ?>
- The topic ‘Modifing sidebar menu – wp list pages’ is closed to new replies.