Hey people, I’m snowed off work so I’ve been in this forum a lot over the last few days, hope people are taking advantage of the mayhem a bit of snow causes (in the UK at least) lol.
I’m building a toggle menu in jquery using wp_list_pages, so far so good but for what I am doing I need to list the pages with children and the pages without children separately, due to adding a class in the top level pages that allows the subpages to slide down, but not needed for those without children.
I found this post solved the problem of only displaying pages with children:
I now need to only display pages that don’t have children. I’m sure this is very simple, and I would be really grateful if somebody could actually talk me through the code too. The part I don’t really understand is to do with post.parents:
I have read a lot of information in the codex relating to how to only show subpages when in the parent page, or only when on child pages from the same parent, but I want this menu to be the same no matter where viewed from, except with dynamic highlighting, but I’ll cross that bridge when I come to it!
- The topic ‘How to only list pages if they have no children’ is closed to new replies.