Title: wp_list_pages() question
Last modified: August 18, 2016

---

# wp_list_pages() question

 *  [adeking](https://wordpress.org/support/users/adeking/)
 * (@adeking)
 * [19 years ago](https://wordpress.org/support/topic/wp_list_pages-question/)
 * Hi,
 * I am trying to hack at an existing theme and have become stuck.
 * My blog has a horizontal top bar which is my main navigation. I have set the “
   depth” to 1 on this so that any sub-pages (or child pages as it were) do not 
   display. In other words, only the parent pages of my blog appear in this top 
   navigation.
 * When a user clicks on a specific parent page. I want all the child pages for 
   that parent to appear in a vertical sidebar.
 * Can anyone let me know how I might do about doing this?
 * Thanks – the site is [http://www.macmillan-academy.org.uk/staff_blogs/mrking](http://www.macmillan-academy.org.uk/staff_blogs/mrking)

Viewing 15 replies - 1 through 15 (of 16 total)

1 [2](https://wordpress.org/support/topic/wp_list_pages-question/page/2/?output_format=md)
[→](https://wordpress.org/support/topic/wp_list_pages-question/page/2/?output_format=md)

 *  [MichaelH](https://wordpress.org/support/users/michaelh/)
 * (@michaelh)
 * [19 years ago](https://wordpress.org/support/topic/wp_list_pages-question/#post-563546)
 * Here’s some possibilities though the first listed seems to handle your requirements:
 * [http://www.mealldubh.org/index.php/software/fold_page_menus/](http://www.mealldubh.org/index.php/software/fold_page_menus/)
   
   [http://navyroad.com/2007/01/04/folding-pages-wordpress-widget-released/](http://navyroad.com/2007/01/04/folding-pages-wordpress-widget-released/)
   [http://www.yellowswordfish.com/my-wordpress-plugin-library/page-category-organiser-wordpress-plugin/](http://www.yellowswordfish.com/my-wordpress-plugin-library/page-category-organiser-wordpress-plugin/)
   [http://www.webspaceworks.com/resources/wordpress/30/](http://www.webspaceworks.com/resources/wordpress/30/)
   [http://sporkfancier.com/collapsing-page-menus-plugin](http://sporkfancier.com/collapsing-page-menus-plugin)
   [http://www.cimatti.it/blog/2007/01/21/cimy-page-navigator-en/](http://www.cimatti.it/blog/2007/01/21/cimy-page-navigator-en/)
 *  Thread Starter [adeking](https://wordpress.org/support/users/adeking/)
 * (@adeking)
 * [19 years ago](https://wordpress.org/support/topic/wp_list_pages-question/#post-563547)
 * Hi,
 * Sorry, but I am not looking for a collapsable menu. I need to display ONLY the
   second tier of pages for a specific parent.
 * Thanks for your reply.
 * Adrian
 *  [Alex Cragg](https://wordpress.org/support/users/epicalex/)
 * (@epicalex)
 * [19 years ago](https://wordpress.org/support/topic/wp_list_pages-question/#post-563552)
 * not entirely sure of the code, but look at conditional tags and querying the 
   title.
 * so you get the page title, and output wp_list_page but in the () put to only 
   display child pages of the title you are on.
 *  [Alex Cragg](https://wordpress.org/support/users/epicalex/)
 * (@epicalex)
 * [19 years ago](https://wordpress.org/support/topic/wp_list_pages-question/#post-563556)
 * maybe something like…
    if(get_the_title($post->post_parent) != the_title(‘ ‘ ,‘‘,
   false)) { echo wp_list_pages(‘depth=-1’); }
 * its a bit of a guess though, and probably wrong, but hopefully a pointer.
 *  Thread Starter [adeking](https://wordpress.org/support/users/adeking/)
 * (@adeking)
 * [19 years ago](https://wordpress.org/support/topic/wp_list_pages-question/#post-563558)
 * Hi,
 * Yea, cheers this is what I am after. I too hada similar idea, but didnt know 
   how to implement. I will see what I get with that.
 * Any other suggestions most welcome….
 *  [Alex Cragg](https://wordpress.org/support/users/epicalex/)
 * (@epicalex)
 * [19 years ago](https://wordpress.org/support/topic/wp_list_pages-question/#post-563560)
 * maybe the child_of parameter might help…
 *  Thread Starter [adeking](https://wordpress.org/support/users/adeking/)
 * (@adeking)
 * [19 years ago](https://wordpress.org/support/topic/wp_list_pages-question/#post-563663)
 * Hi,
 * Thanks for all your help epicalex but I am useless at PHP code – just a beginner
   really.
 * I have been playing around with the code you sent, but I am not getting it to
   display the correct level of navigation.
 * If annyone else would like to suggest a tutorial – or a piece of code that works
   then I will be over the moon!!!
 * thanks
 * Adrian
 *  [sadish](https://wordpress.org/support/users/sadish/)
 * (@sadish)
 * [19 years ago](https://wordpress.org/support/topic/wp_list_pages-question/#post-563673)
 * Most of my themes have this functionality built in.
    download for example my 
   mistylook theme at http:://wpthemes.info/misty-look/version-3/ and take a look
   at the page.php file.
 * Thats what you need.
 * Sadish
 *  Thread Starter [adeking](https://wordpress.org/support/users/adeking/)
 * (@adeking)
 * [19 years ago](https://wordpress.org/support/topic/wp_list_pages-question/#post-563675)
 * Hi Sadish,
 * Thanks very much for your reply. I have downloaded your excellent theme and am
   looking through it now.
 * I cant find anything that looks like it could help on page.php, do I need to 
   look through page-links.php? Or possibly sidebar.php?
 * Is the functionality you are talking about on your theme options page? And if
   it is – does that mean it cannot be easily transfered to my theme?
 * Thanks – and sorry for all the questions.
 * Adrian
 *  [sadish](https://wordpress.org/support/users/sadish/)
 * (@sadish)
 * [19 years ago](https://wordpress.org/support/topic/wp_list_pages-question/#post-563686)
 * It must be in page.php and perhaps you missed it.
 * lets do this.
    open up your theme’s page.php and put this code [http://pastebin.ca/491582](http://pastebin.ca/491582)
   in it just below the call to the_content().
 * See if it works.
 * Sadish
 *  [Karita](https://wordpress.org/support/users/karita/)
 * (@karita)
 * [19 years ago](https://wordpress.org/support/topic/wp_list_pages-question/#post-563690)
 * I wanted to do almost the same thing with my website. I have only parent pages
   on the navigation tab, and also on the sidebar! Once you click on a page, it 
   shows all the sub pages (offered by the mistylook theme, thanks Sadish!)
    What
   I used for my side bar was this:
    -  <?php
       wp_list_pages(‘exclude=1, 2, 3’ ); ?>
 * With 1, 2 and 3 being the Page_ID of the pages you don’t want displayed on the
   sidebar.
 *  Thread Starter [adeking](https://wordpress.org/support/users/adeking/)
 * (@adeking)
 * [19 years ago](https://wordpress.org/support/topic/wp_list_pages-question/#post-563694)
 * Hi Sadish
 * IT works!!!!!
 * Love you!!!!!
 *  [sadish](https://wordpress.org/support/users/sadish/)
 * (@sadish)
 * [19 years ago](https://wordpress.org/support/topic/wp_list_pages-question/#post-563699)
 * Thanks Karita / adeking 🙂
 * Its a pleasure !
 * Sadish
 *  [Alex Cragg](https://wordpress.org/support/users/epicalex/)
 * (@epicalex)
 * [19 years ago](https://wordpress.org/support/topic/wp_list_pages-question/#post-563700)
 * sadish, i was wondering how this can work in a sidebar, im assuming it has to
   be called within the loop as it is? or am i just not getting it at all? ive got
   it working in index.php after have posts etc, but in the sidebar it produces 
   nothing. thanks
 *  [sadish](https://wordpress.org/support/users/sadish/)
 * (@sadish)
 * [19 years ago](https://wordpress.org/support/topic/wp_list_pages-question/#post-563703)
 * epicalex,
    since this thread is marked as “resolved”, you should post it in a
   new thread.
 * but i have tested this code by putting it in the sidebar.php as well and is working
   in sidebar. paste it somewhere near the top of the sidebar.php before the call
   to the widgets.
 * Sadish

Viewing 15 replies - 1 through 15 (of 16 total)

1 [2](https://wordpress.org/support/topic/wp_list_pages-question/page/2/?output_format=md)
[→](https://wordpress.org/support/topic/wp_list_pages-question/page/2/?output_format=md)

The topic ‘wp_list_pages() question’ is closed to new replies.

## Tags

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

 * 16 replies
 * 5 participants
 * Last reply from: [adeking](https://wordpress.org/support/users/adeking/)
 * Last activity: [19 years ago](https://wordpress.org/support/topic/wp_list_pages-question/page/2/#post-563710)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
