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: « 9 8 7 6 5 4 3 [2] 1 » Show All

  1. 30
    Eddie

    And yes I have subpages on the page I’m trying to get this on just to note.

  2. 29
    Eddie

    I put in the trigger text into a page and nothing at all happens. Your plugin seems very easy to set up, just upload and use trigger text so I don’t see how I missed anything???

  3. Right now I have it set by default to depth of 2, how can I show depth of 1 on a different page without messing up the one that shows depth 2. Can I add that info inside the brackets?

  4. 27
    Mike

    Hello

    How can i add “nofollow” to the links?

    Thanks Mike

  5. 26
    Trevor

    How can I get the new links to not show up in the main top navigation? I want to be able to just add sub page links to different pages but not show up in the main nav

  6. 25
    Damian Taggart

    Is there a way to prevent the “before list” and “after list” HTML from being displayed on pages that don’t have a subpages?

    Thanks!

  7. I’m not seeing the list of subpages on the same level as the current subpage when on a subpage. It works find on pages. Is there a setting that you have to change to see it? (I’m using the php call, if that helps).

  8. Scott: That plugin works a bit differently I believe, although I have not used it.

  9. So, does this plugin work like* the one mentioned above (http://www.webspaceworks.com/resources/wordpress/30/)?

    Does if dynamically list subpages changing he list (in the sidebar) per the current page being shown?

    Thanks.

  10. Manly: It might help to be a little more specific.

  11. plug in doesnt work for me.

  12. nice! would be nice if this supported multi-column output like some of your other plugins.

    However, doesnt appear to be a minor change as I think one would have to use get_pages() instead and traverse manually.

  13. Donna: That would be possible, but it would require a decent amount of modifications. Unfortunately due to the number of requests I receive, I am not able to create custom versions for everyone.

  14. Would it be possible to make this work like your form plugins where you can have more than one sublist options page? So, and and so forth…

    This would be extremely useful to customize how this works for a “press releases” page (show by date) versus some other kind of page where you would want to order by menu order or something.

    As always, great work!

  15. Gigi: You must give it the ID of a page with sub-pages, and the sub-pages will be listed on that page. If you just give it the ID of a sub-page, it will not work properly.

Pages: « 9 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.