Displaying child pages using wp_list_pages and php
-
Page(s) in question: https://www.mfhc.com/wp/our-people/partners/michael-t-mcconnell/
Background info: I’m creating a custom template for one of my clients and am not very familiar with PHP. Anyway, a section of their site is comprised of profiles of various lawyers. All of the profiles use a common template page and custom fields fill in all of the variable data (picture, fax number, vcard etc.).
Next to the biographic information is a sub menu consisting of child pages (Areas of practice, Education etc.). The problem I’m running into is that I don’t know how to display the same wp_list_pages output on the children and grandchildren pages.
Example: Michael T. Mcconnell is a child page of “Our People.” The submenu visible on his profile page is the menu in question. If you click on any of the times, you’ll notice that the menu items disappear. I’m sure this is due to my unfamiliarity with PHP, and if someone could help shine some light on my grey areas, that would be very much appreciated.
Exampe Page Hierarchy:
- Our People
- Michael McConnell
- Areas of Practice
- Education
- Awards
- Etc
Submenu code currently being used:
<?php $children = wp_list_pages('title_li=&child_of='.$post->ID.'&echo=0'); if ($children) { ?> <ul> <?php echo $children; ?> </ul> <?php } ?>
- The topic ‘Displaying child pages using wp_list_pages and php’ is closed to new replies.