Help with list_page function
-
Hello,
I am trying to create a navigation menu for my sidebar. I would like the list to display all top-level pages by default. If there are sub-pages for the current page, I would like to display those also.
For example, assume the home page is the current page; the list of pages should appear like:
Home
About
ServicesIf the about page is the current page, the list should only show the subpages of that specific page, as in:
Home
About
Company Bio
ServicesCan anyone help? I would like to achieve this without use of plugins. My dilemma is how to “break” the generation of the top-level list in order to create the child-level list. Once the child level list is created, the routine should continue parsing all other top-level pages.
Pseudocode example:
// Start creating a list of all top-level pages
// Determine if the current page has children
// If yes, create a nested list of child pages, then continue
// Else, continue creating list of all top-level pagesAny help would be incredibly useful. Thanks.
- The topic ‘Help with list_page function’ is closed to new replies.