I’m using wp_list_pages('title_li=')
on my site.
Some of my pages do have subpages, however I don’t want to list them unitl I’m on an actual parent page that has subpages.
So imagine my front-page:
â About Us
â Gallery
â Kitchen
â Disclaimer
When clicking on Gallery (and Gallery has two subpages) I want them to be listed as well.
â About Us
â Gallery
â Subpage 1
â Subpage 2
â Kitchen
â Disclaimer
How am I going to do this with the wp_list_pages()
function?
This would probably be better achieved using CSS. First, you hide all .children:
Then, you show the current_page_item’s children:
try the following:
expl:
depth
(integer) This parameter controls how many levels in the hierarchy of pages are to be included in the list generated by wp_list_pages. The default value is 0 (display all pages, including all sub-pages).
For mor info can have a look here