Welcome to Dagon Design. In addition to free scripts, WordPress plugins, and articles, we offer a variety of services including custom theme design, plugin creation, and PHP scripting. Contact me for more information.

Version 1.0   Updated Friday, February 20th, 2009 at 7:19pm

List Subpages Plugin for WordPress

This WordPress plugin generates a list of subpages for the page being viewed. You can use this plugin by inserting the trigger text in your page (where you want the list to appear), or by calling the function directly from your template file. One key feature of this plugin is that it can used outside the loop, which means you can display a list of subpages of the current page in your header, sidebar, or anywhere else. There are also several options available. You can change the sort method, exclude pages, adjust the page depth, show the date, and more.

Download

  If you have found this page useful, please consider donating. Thanks!

Installation

  • Download the above file
  • Rename dd-list-subpages.txt from .txt to .php and upload it to your plugins directory
  • Activate the plugin from the WordPress admin panel
  • Configure the options under the admin panel: Options – DDListSubpages

Change Log

  • 04-06-07 Version 1.0 – First release.

Usage

To display the list of subpages on your page, just add the trigger text to your page:

<!-- ddlsp -->

(If you are using the visual editor in WordPress, you may have to temporarily disable it to add in the trigger text)

You can also call the function directly from a template file with the following command:

<?php echo ddlsp_generate(); ?>

If you use this method, it does not have to be in your loop, which means you can display the list of subpages anywhere you like in your theme.

Whichever method you use, just remember that it only generates the list when viewing an actual WordPress page which has subpages.

Options

Here are the options available for this plugin under the WordPress admin panel. The options page also includes a ‘load defaults’ button.

Before List

This text is added before the list of pages.

After List

This text is added after the list of pages.

Sort Column

You can choose to sort the list by page title, menu order, page date, page modified date, page ID, page author, or page name (slug).

Sort Order

This lets you choose between an ascending or descending sort.

Excluded Items

This is a comma-separated list of page IDs you want to exclude from the list.

Included Items

This is a comma-separated list of page IDs you want to include. If you use this feature, only pages manually specified will be listed.

Page Depth

This is the depth of subpages that will be shown. The default is 1, and 0 means no limit.

Show Date

If enabled, the date will be shown after each page.

Date Format

If showing the date, this is the PHP date format that will be used.

List Title

This is an optional header for the list of pages.

Pages: « 8 7 6 [5] 4 3 2 1 » Show All

  1. Is it possible with this plugin to create a list of subpages with each li having specific arguments like, eg. pointing to an anchor instead of pointing to the url of the page?

  2. Excellent! Works a treat on 2.6 and K2. Marvellous. Thanks a lot.

  3. 73
    KermitJr

    Might want to change your bar at the top… I saw “Updated Friday, April 6th, 2007 at 4:16pm” and thought it was a year and a half old. Almost went past your AMAZING plugin.

    Thanks for the work.

  4. 72
    Vanessa

    Thanks! It’s working on 2.6.1 for me.

  5. Very very good plugin. I’ve been looking around for something like this for a long time. Is it possible to list subpages in one row instead of coolumn? It would take much less space in header if it could be in row.

    Tnx

  6. 70
    Joe Banks

    Huge fan of your SiteMap plugin. And now this one, too!

    Feature request: Ability to add an optional “excerpt” (custom field, perhaps) for a page, which gets printed after each item. I use this plugin for a quick index page, mostly.

    Example below — What comes AFTER the colon (perhaps the colon could be a custom character) is the “excerpt”:

    Pageandlink: Blah blah blah.

    Anotherpageandlink: Blah blah, blatty blah.

    AndAnotherpageandlink: Yessirree, blah blah, blatty blah. Bleep blorp.

  7. 69
    Jason

    Does this work in 2.6? When I install I don’t see any administrative options. Are you working on an update to 2.6?

  8. Can it be parametered? I’d like to use different settings of listing pages on two separate pages (like, having dates on one and depth of 2; not having dates on the other with depth of 1).

  9. It’s great plugin, I’m looging for sometimes ago, I’m going to install it. Thanks

  10. 66
    pablo

    great stuff. any chance that this will include a button for the TinyMCE editor in the future?

  11. thank you very much for your helpful plugins.

  12. thanks.

  13. How can I code the submenu to not overlap the top menu? http://www.abovethecrowdphoto.com/index.php (look on the services page)

  14. Thank you so much! I’m a noobie and the struggle with the php code was really eating into my writing time. Thank you for this plugin, it was exactly what I needed and really easy to use. bama :)

  15. The sublist doesn’t seem to work with private pages, even though the logged in user has the capabilities to read private pages.

Pages: « 8 7 6 [5] 4 3 2 1 » Show All

Leave a Comment

Before you comment: If you are having an issue with a script, please make sure you have read the entire article. Also, please read through the comments because most common issues have already been discussed many times. Thanks.


Be sure to wrap all code in <code></code> tags.