I’m getting around this using the Child Pages Shortcode plugin, but if there’s a way to do it with custom content shortcode, I’d appreciate hearing about it.
Hello,
I’m sorry it took me some time to get back to you.
I set up a test, and the following code is working on my end:
[loop type="page" parent="this"]
[field title]
[/loop]
This should list all pages whose parent is the current page.
Only the first child is listed.
That’s strange, I wonder what is different in your setup.. Do you mean the first child, or the first-level children?
In the newest plugin update, I added a parameter to include all child and descendants of each post in the loop.
So, the following should list all children, grandchildren, etc. of the current page.
[loop type="page" parent="this" include="children"]
[field title]
[/loop]
I added a note about this in the documentation, under Main Features -> Loop -> Parent/Children.
There’s also a more flexible (but verbose) way to display descendant pages, using nested loops.
[loop parent="this"]
Child page: [field title]
[-loop parent="this"]
Grandchild page: [field title]
[/-loop]
[/loop]
Tried this and it looks like what I was missing was the
type="page"
Given a structure
Page1
If I put your loop on Page 1, I get both children listed. But if I delete the type parameter, only one of the Children is listed (even after updating to 2.2.6).
With 2.2.6, your first loop example with include=”children” is working fine to display grandchildren and great-grand-children of the original page.
Thanks for the help and for the awesome plugin in general!
Thank you for the explanation.
if I delete the type parameter, only one of the Children is listed
I see, it looks like you’ve discovered some quirk in the query algorithm – that it requires the type parameter to be specified, to list all children. The default value of type is supposed to any, so I’m not sure why that’s not working as expected. I’ll look into this to see if I can correct it.
Glad to hear that the new include parameter is working for you.