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.

  • Stuff
    • more stuff
    • more stuff1
    • more stuff2
  • It has no children
  • Other with children
    • etc
    • etc 2

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.

**** I've used the following. Currently trying to figure out how to use ACF with the results. For example: If Advanced Custom Field"x" exists then use that instead of the title (basically use an image for the title instead depending on if that field exists and is being used)

                $children = wp_list_pages("title_li=&child_of=".$post->post_parent."&echo=0&post_type=physicians");
                $children = wp_list_pages("title_li=&child_of=".$post->ID."&echo=0&post_type=physicians");
            if ($children) { ?>
                <ul class="sub_post_nav">
                        <a href="/">
                    <?php echo $children; ?>
                    <div class="clear"></div>
            <?php }?>
  • Is this for a sidebar? If I understand you want to display the menu hierarchy even if you are at the child page, which is not default behavior of wordpress. If so, take a look at this section of the codex. codex.wordpress.org/Function_Reference/… – gdaniel Jul 29 '14 at 1:43
  • @gdaniel , not its not for the side bar actually. It was going to be part of the template main div – RMH Jul 29 '14 at 2:00
  • Regardless. If what you want to accomplish is to show the siblings and parent of a child page you just need to check if the page you are is a child page or a parent page. If it's a child page then you can retrieve its parent ID and pull all its siblings. If you're already at the parent level, then you just need to print its children. The link I posted above shows how to do that. If you don't want to show the parent at all you can just change the depth settings of wp_list_pages. – gdaniel Jul 29 '14 at 2:06
  • @MarkKaplun, I've udpated the questions above to show what I currently have – RMH Jul 29 '14 at 5:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.