Title: Wp_list_pages Menu
Last modified: August 18, 2016

---

# Wp_list_pages Menu

 *  [basketball](https://wordpress.org/support/users/basketball/)
 * (@basketball)
 * [18 years, 7 months ago](https://wordpress.org/support/topic/wp_list_pages-menu/)
 * Does anyone know how to display a list of pages like it’s done on this site (
   regular html):
 * [http://www.pharmacybenefitconsultants.com/index.htm](http://www.pharmacybenefitconsultants.com/index.htm)
 * It just shows the top level pages when on the homepage, and only shows the subpages
   if you’re on one of those particular subpages. I was thinking of using the wp_list_pages
   template tag and modifying depth using conditional statements to get something
   like:
 * `<?php wp_list_pages('sort_column=menu_order&exclude=3&depth=1&title_li=' . __('').'');?
   >`
 * for the homepage, and:
 * `<?php wp_list_pages('sort_column=menu_order&exclude=3&depth=2&title_li=' . __('').'');?
   >`
 * For all the other pages, but the problem is if I am in a subpage in a particular
   section, it’ll expand the subsections from all the other sections.
 * Anyways I was just wondering if anyone knew of a plugin or some php I could use
   to get that to happen.
 * Edit: something like this ([http://wordpress.org/support/topic/96827](http://wordpress.org/support/topic/96827)),
   but the all the pages show up, and the subpages show up underneath the main page.
 * Edit: I also looked through all the search results for “display child pages” 
   but couldn’t find anything that displays both the pages and the subpages, but
   the subpages only when you’re on that specific subpage.

Viewing 2 replies - 1 through 2 (of 2 total)

 *  [Aaron D. Campbell](https://wordpress.org/support/users/aaroncampbell/)
 * (@aaroncampbell)
 * [18 years, 4 months ago](https://wordpress.org/support/topic/wp_list_pages-menu/#post-624402)
 * I’m looking for this too. I’m trying to display only top level pages AND pages
   that are either children of the current page, or children of the ancestors of
   the current page. So, if I have a page structure like this:
    A > R > > U > > 
   > X > > > Y > > > Z > > V > > W > S > T B > P C > Q D E F
 * On the main page, I’d like to display all the top level pages: A, B, C, D, E,
   F
 * On page ‘A’ I would like to display:
    A > R > S > T B C D E F
 * On page ‘R’ I would like to display:
    A > R > > U > > V > > W > S > T B C D E
   F
 * On page ‘U’ I would like to display:
    A > R > > U > > > X > > > Y > > > Z > >
   V > > W > S > T B C D E F
 * Basically, it would be like an expanding tree, but it would not use javascript,
   it would simply build the menu based on the current page. It seems like this 
   would be a common desire. Is there something like this out there, or some simple
   way of doing it?
 *  [Aaron D. Campbell](https://wordpress.org/support/users/aaroncampbell/)
 * (@aaroncampbell)
 * [18 years ago](https://wordpress.org/support/topic/wp_list_pages-menu/#post-624437)
 * First I wrote a [WordPress Plugin](http://xavisys.com/wordpress-mark-parent-pages-plugin/)
   for this, but then it was included in the core in WordPress 2.5. However, the
   CSS on that page will still allow you to use the classes that were added to hide
   pages.

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Wp_list_pages Menu’ is closed to new replies.

## Tags

 * [menu](https://wordpress.org/support/topic-tag/menu/)
 * [pages](https://wordpress.org/support/topic-tag/pages/)
 * [structure](https://wordpress.org/support/topic-tag/structure/)
 * [wp_list_pages](https://wordpress.org/support/topic-tag/wp_list_pages/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 2 replies
 * 2 participants
 * Last reply from: [Aaron D. Campbell](https://wordpress.org/support/users/aaroncampbell/)
 * Last activity: [18 years ago](https://wordpress.org/support/topic/wp_list_pages-menu/#post-624437)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
