List Pages at Depth

Plugin version: 1.1
Requires WordPress version: 2.8+
Tested up to WordPress version: 3.1.3
Download: Click here to download...


This plugin creates a more powerful version of the wp_list_pages() function which allows you to specify a start depth.

This means you can easily display secondary and tertiary navigation seperately from the primary navigation on your site.

The list_pages_at_depth function accepts all the same arguments as wp_list_pages, but has an additional argument called ‘startdepth’. Set this to be 0 to display primary navigation, 1 for secondary navigation etc.

If you want to display secondary navigation with indented tertiary navigation you can use this in conjunction with the depth argument – simply set startdepth to 1 and depth to 2.

<?php list_pages_at_depth(array('startdepth' => 1,'depth' => 1)); ?>

The plugin also features a widget so you can easily implement a page list in your sidebar.

Feedback and Support

Please leave comments with feedback below.
If you require support, it is best to post it in the Forum.

A little poll…

Would you like the 'startdepth' parameter to be added to wp_list_pages in WordPress core?

View Results

Loading ... Loading ...


insurance attorney Atlanta

36 Responses to “List Pages at Depth”

  1. WordPress Plugin Releases for 11/28 « Weblog Tools Collection Says:

    [...] List Pages at Depth [...]

  2. Geert van der Heide Says:

    How can i delete the list heading (default “Pages”)?

  3. Ben Says:


    It accepts the same parameters as wp_list_pages so you should just be able to use:

    < ?php list_pages_at_depth(array('startdepth' => 1,'depth' => 1, 'title_li' => '')); ?>

  4. Geert van der Heide Says:

    Superrrr! Thanks it’s works!
    Geert van der Heide

  5. Drew Says:

    Thank you so much for this!

  6. Drew Says:

    One problem, this doesn’t seem to be working on the archive or category pages. Am I doing something wrong?

  7. Drew Says:

    How can I call subpages from another parent?

  8. Inga Says:

    hi thanx for this plugin, but it just works with the first navigation-level like:
    0,’depth’ => 1)); ?>

    the second level:
    1,’depth’ => 1)); ?>
    this doesn’t work and i can’t figure out why!?!

    i work with wordpress 2.9.2. any idea?

  9. Ben Says:

    Drew, you can’t see sub pages on category and archives pages because they don’t have subpages. I guess it would be a nice feature to add so that it can be used to show sub categories on category or archive pages?

    You can’t currently call subpages from another parent but I plan to add that at some point.

  10. andre.roesti Says:

    Thank you very much for this Plug In. After hours of trying i found your Plugin and i implemented it straight into my theme – works just fine!

    Many Thanks.

  11. Sandra Says:

    Thank you for this awesome plug-in! I figured out the answer to my question… should have read through the other posts a little closer.

    Thanks again!

  12. Byzas Travel Says:

    Great plugin! Thank you!

    To help others, here’s the working code for how I was able to change the title to what I wanted (and to have it display inside a Header3 tag):

    1,’depth’ => 2, ‘title_li’ => ” . __(‘Replace This Text with Any Header You Like to Display:’) . ” )); ?>

    The above works.

    However I have found that an additional unclosed tag is somehow appearing in front of my Header3 in the code. I couldn’t figure out where it is generated from yet. But it makes my Header line display as a list itself also, which I’d like to remove. Any ideas?

  13. Byzas Travel Says:

    Sorry some code seemed to get cut off. It should read:

    1,’depth’ => 2, ‘title_li’ => ” . __(‘Also in this Section:’) . ” )); ?>

  14. Tours of Turkey Says:

    Thank you for the information but I guess there is something wrong that I am doing….

    the second level:
    1,’depth’ => 1)); ?>

    not working for me also….

  15. Timichango Says:

    Works like a charm—THANK YOU!

  16. Timichango Says:

    p.s. – I’m using wordpress 3.1.1, and it seems to function perfectly.

  17. perryb Says:

    Fab plugin – I can’t find a single other sub menu plugin that allows you to choose the level at which the menu starts – plenty allow you to choose the level it stops at. Great for building dynamic contextual menus in a CMS layout (e.g level 1 in main menu, level 2 in sidebar).

    Very simple to use too.

    If you ever get the chance please update it to go with the latest version of WordPress (though as noted above it appears to work fine with 3.1.4)

  18. perryb Says:

    Works fine in 3.2 too it seems :)

  19. Simon Melhuish Says:

    Dude, I’ve been pulling my hair out trying to code this functionality myself. Life saver! Keep up the good work.

  20. mixmedia Says:

    Hello, the plugin works fine, but i have a question: Is it possible to display only the children-pages of the active parent-link? It shows now:
    Chapter 1
    - Child 1
    - Child 2
    - Child 3
    Chapter 2
    - Child 1
    - Child 2
    - Child 3

    But I want it to show like this (if Chapter 2 is active):
    Chapter 1
    Chapter 2
    - Child 1
    - Child 2
    - Child 3

    Is this possible with this plugin? If yes could you please tell me how?

  21. Ben Says:


    You can do that by adding styles to your theme. Something bit like the following:

    ul.list-pages-at-depth ul {
    ul.list-pages-at-depth li.current_page_item > ul,
    ul.list-pages-at-depth li.current_page_ancestor > ul {
  22. Whit Says:

    Hi Ben,

    Just what I needed, thanks! One question, though: how can I change the text that says “Pages” in the displayed content? I’m not seeing that anywhere, even in the plugin code. Is there a parameter that I can use to dictate what it says there?


  23. Ben Says:

    @Whit It accepts exactly the same parameters as the WordPress wp_list_pages() function so you can just pass another attribute ‘title_li’ => ” to remove the list title.

  24. Timichango Says:

    Still using this plugin on almost every site I build. Left you a donation about a year ago, and leaving you another one now as this badboy’s been the right tool for the job yet again.

    Awesome, possum!

  25. Robbiegod Says:

    I just found your plugin, installed it, and i’ve run into a problem with it.

    Here is what i am trying to do:

    My site structure is like this:

    Parent Page
    - Subpage01
    – Child 1
    – Child 2
    – Child 3
    - Subpage02
    – Child 1
    – Child 2
    – Child 3

    And so on. I’m trying to list only the child pages of the Parent Page. So i think my depth should be set to 3 and my startdepth should be 3 as well. That should show me only the child pages. Instead i get a blank page when i set the startdepth to value to 1. I tried start depth 2 and 3 as well and i get the same result.

    What am i doing wrong?

  26. Robbiegod Says:

    I should mention i am using Wordpress v3.3.2.

  27. Robbiegod Says:

    i gave up on doing it with your plugin. I don’t know if it was something i was doing wrong or if maybe there is some small incompatibility with latest version of the wordpress. I’m still interested in seeing if your plugin works, for now i am using tags2pages to get at the third tier pages.

  28. tmagee Says:

    I’m using the new Menu system in 3.3.1 and noticed that the plugin is not pulling from that structure but rather using wp_list_page(). I’m wondering if there’s any plan to update the plugin or if anyone can provide another solution. Thanks

  29. Ben Says:

    @tmagee The plugin does not currently do that, although it is interesting functionality to consider for future development. I’ve added an issue here but it’s a low priority.

  30. BTT Travel Turkey Says:

    Many people get confused about the code, but i think the first parameters startdepth = 1 means, turns the plugin on.
    and the dept =1 parameter tells the plugin how many level it shoulp display.
    please correct me if i am wrong

  31. Ben Huson Says:

    ‘startdepth’ is used to specify at what depth you would like to start displaying a list.
    Th nav will only show if the page you are viewing is the same level or deeper than the startdepth,
    So for example if you had a complex nav structure like this, and I am on page Level 3b1b:

    - Level 1
    - Level 2
    – Level 3a
    — Level 3a1
    — Level 3a2
    – Level 3b
    — Level 3b1
    —- Level 3b1a
    —- **Level 3b1b**
    — Level 3b2
    – Level 3c
    - Level 3

    If you specify a startdepth of 0, the entire nav will show.

    If you specify a startdepth of 1, it will display:

    - Level 3a
    – Level 3a1
    – Level 3a2
    - Level 3b
    – Level 3b1
    — Level 3b1a
    — **Level 3b1b**
    – Level 3b2
    - Level 3c

    If you specify a startdepth of 2, it will display:

    - Level 3b1
    – Level 3b1a
    – **Level 3b1b**
    - Level 3b2

    If you specify a startdepth of 3, it will display:

    - Level 3b1a
    - **Level 3b1b**

  32. Matt Says:

    Hey Ben,

    awesome plugin.
    I get the whole idea behind the depth, but I have one problem, on a page I want to display only Level 2 and at another point on the same page I want to display only Level 3.

    Like this:

    But the page won’t give out my Level 3.
    It will only display my Level 2 and when I go on a level 2 page it will display Level 3 aswell, but I need it before ;)


  33. Ben Huson Says:


    It can only display level 3 if you are on a level 2 page as otherwise it doesn’t know which level 3 to show.

    For example, if you have 3 pages at level 2 all with child pages, if you are not on one of those level 2 pages it would not know which children to show at level 3.


  34. Matt Says:

    Ok, thanks, in that case, I would have to use another plugin.

    Thank You!

  35. Midday Travel Says:

    Thank you very much for the explanation.
    I have got a better idea of understanding of ‘startdepth’ especially.

  36. DOJ Webmaster Says:

    Looks like with WP 3.7 the STARTDEPTH or DEPTH parameter is off?

    When visiting this page I only want the depth to be 1.

    After upgrading to 3.7 this morning it will only show DEPTH 2 when the widget is set to 1?

    I am willing to make a $50 donation for a fix – and again thanks for helping the WP community!!

Leave a Reply