Im stuck on this and any help would be appreciated.
Say there is a parent page called "Stuff". And Stuff has several pages under it.
So when you click on "more stuff". That page would list all the pages under stuff ('more stuff, morestuff1, morestuff2'). Or if you click on "etc" you would see "etc, etc2"
Any thoughts or help would be appreciated. I'm using the Types plugin and have hierarchical setting turned on already.
You can use the wp_list_pages
function. In http://codex.wordpress.org/Function_Reference/wp_list_pages , scroll down to the section with sub-heading "List subpages even if on a subpage" to see an example. Just make sure to pass the post_type
parameter like this and include the code inside the loop of your single template file:
<?php
if($post->post_parent)
$children = wp_list_pages("title_li=&child_of=".$post->post_parent."&echo=0&post_type=<post_type>");
else
$children = wp_list_pages("title_li=&child_of=".$post->ID."&echo=0&post_type=<post_type>");
if ($children) { ?>
<ul>
<?php echo $children; ?>
</ul>
<?php }
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.