Sub Pages ONLY For Current Parent Page
-
Alright I’ve got a theme going using mostly pages. I’ve got a set of parent pages, and each one has multiple children pages. If I want to call a list of all the top level pages in the sidebar, I use:
<ul> <?php wp_list_pages('title_li=&sort_column=menu_order&depth=1')); ?> </ul>
Which works fine. When someone clicks on a top level page, I want the sidebar to now display a list of top level pages, with the children ‘expanded’ under the top level page that is currently being viewed. Right now I’m using this:
<ul> <?php wp_list_pages('title_li=&sort_column=menu_order&depth=2')); ?> </ul>
Which works, but lists ALL children pages under ALL parent pages. I hid the other, unwanted children using CSS, but I’d rather just not even have them on the page. Without using a plugin, is there a way to modify that call to show all parent pages, along with the children pages of ONLY the current parent?
- The topic ‘Sub Pages ONLY For Current Parent Page’ is closed to new replies.