Display all submenus

Ok, the problem in my solution was the use of $menu_item->ID instead of $menu_item->object_id. So the full correct logic is like so: function print_sub_menus() { global $post; // get current page $post_id = $post ? $post->ID : -1; $has_post_parent = $post && $post->post_parent; $top = $has_post_parent ? array_pop( get_post_ancestors($post_id) ) : $post_id; // get all … Read more

only display Pages which have children

Do you want to list only the pages with children? I’m not sure to understand well what you want to do 🙁 If I’m right, you’ll have to do something like this with get_pages() and generate your listing manually after: // First get all pages $pages = get_pages(); // Then, get page IDs if ($pages) … Read more

Listing current pages subp page in list items in the sidebar

In this way you add in “exclude” parameter like this ‘exclude’ => ”, // here add this page id you don’t show in listing. ‘exclude’ => ‘2,4’, like this If you want only child pages you will use get_page_children() function. Please see this link for reference http://codex.wordpress.org/Function_Reference/get_page_children

Non page link in wp_list_pages

I don’t know what you mean by “open a second navigation”. That could mean several things. But to get an “empty” link you have a couple of choices: Option #1– aka, easy but kind-of a hack Add a menu item with the “Custom Links” form. You have to provide an URL but you can delete … Read more

Get current post’s child page?

$ancestors = array(); $ancestors = get_ancestors($post->ID,’page’); $parent = (!empty($ancestors)) ? array_pop($ancestors) : $post->ID; $parent should be the topmost page parent. However, if you are using a WordPress generated menu there is a pretty good chance that there is already a item identified by a CSS class as the parent. Take a good look at the … Read more