Kleines Snippet zu einer Navigation mit 2 Ebenen in typischer Listenverschachtelung. Die Unterebenen sollen jedoch nur dann zu sehen sein, wenn der Eltern-Menüpunkt angeklickt wurde:
<?php global $post; // http://www.sitepoint.com/forums/showthread.php?t=668865 $thispage = $post->ID; // grabs the current post id $pagekids = get_pages('child_of='.$thispage); // gets a list of pages that are sub pages ?> <?php if ($pagekids || ($post->post_parent > 0)) { // exists sub pages OR selected a sub page ?> <ul> <?php wp_list_pages('title_li='); // display all pages ?> </ul> <?php } else { ?> <ul> <?php wp_list_pages('depth=1&title_li='); // display only parent pages ?> </ul> <?php } ?>