Display list of child pages plus all parent pages
-
Hello!
I am having trouble displaying a list of parent pages and child pages. On my front page I want to display all my pages (a list of products), which I simply do with wp_list_pages, but with a few exclusions which I do with exclude.
Each product is a parent page, but only a few of them have children. When I click on a parent page that has children, I want the children for that page to be displayed, but I still want to display all the other parent pages. Other parent pages with children shall not have their children displayed (probably done with is_page?).
Also, if I click on a child page, it displays the same list as if I’m visiting a parent page. The page that I’m visiting should also have an “active” css class.
I suppose this is done using depth and child_of in wp_list_pages, but I just can’t figure it out? Can anyone help?
- The topic ‘Display list of child pages plus all parent pages’ is closed to new replies.