List Pages at Depth

Plugin version: 1.1
Requires WordPress version: 2.8+
Tested up to WordPress version: 2.9.1
Download: Click 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 WordPress.org Forum.

A little poll…

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

View Results

Loading ... Loading ...

Donate

11 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:

    @Geert,

    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!
    Regards,
    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!

Leave a Reply