Displaying child page links under the mina nav links
-
Hello, I used some Code that Esmi wrote on a forum post:
https://www.ads-software.com/support/topic/only-display-sub-pages-when-top-level-page-is-clicked?replies=11the code is:
<?php $my_pages = wp_list_pages('title_li=&depth=1&echo=0'); if (is_page()) { $this_page = $post->ID; if ($post->post_parent) $this_page= $post->post_parent; $children = get_page_children($this_page, get_pages()); if($children) { $my_pages .= " <li>\n".'<ul class="subpages">'; foreach($children as $child) { $my_pages .= wp_list_pages('title_li=&include='.$child->ID.'&echo=0'); } $my_pages .= '</li> '; } } echo $my_pages; ?>
and it works great – the 2nd nav only displays under the first once the parent link is clicked.
Unfortunately though I cannot order the links as i want to – they only display in alphabetical order. I tried installing the Plugin ‘Simple Page Ordering’ by Jake Goldman – but this seemed to clash with my code the 2nd level deep child links and caused it to not display as i wanted anymore.
Any suggestions welcome!
Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
- The topic ‘Displaying child page links under the mina nav links’ is closed to new replies.