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. 90
    vicky

    works great on my 2.7 version of wordpress

  2. 89
    coolguy99

    Thanx for the great plugin…..
    i have some doubt with the plugin,is it possible to have subpages horizontally just like this site do and also title short but not the original title.

    http://videos.smartdesis.com/telugu-online-movies-index-a/

    thanx for sharing the great plugin

  3. wow, excellent – works like a charm with my 2.5 installation. Will it also work with version 2.7?

    Thanx for sharing,
    Higgins

  4. 87
    ionut

    I’m interested if I could limit the number of subpages in any way, I have many subpages and I would like to show only the last 10 pages. I use subpages like post.

  5. 86
    paul

    thank you for saving me from the horror that is trying to style wp_list_pages, how they made it so bad i have no idea, but you just cannot seperate the stylings of the title from the contents of the li, or the contents of the UL…….. 10 hours later and i find this, wonderful!

  6. 85
    Michael

    Has anyone tried the plugin with 2.7?

  7. Great plugin…how would it work with categories?

  8. 83
    Zainab

    It would be cool to list descriptions of the subpage after each link.
    And better yet, list subpages of subpages. I’ve been looking for a plugin like that.

    For example:

    WRITING
    Welcome to my page about writing.

    SHORT STORIES
    Short Story 1 – This is about blah blah blah.
    Short Story 2 – Blah blah blah.

    POEMS
    Poem 1 – Blah blah blah

    It would be nice if you could make this. I’m sure many people (ahem, me) would benefit from it.

  9. 82
    Jaap

    I just can’t get it to work… I’m using WP 2.6 can that might be the problem?

  10. 81
    Demoniz

    Im using it for wordpress 2.6.2 but it seems nothing happens with the depth, im trying to change the number from the page depth from admin area but it always show all subpage list , it cannot change can you help me ?

  11. Now all we need is a way to extract subpage excerpts!

  12. hi
    now what i want is to show links list of that page’s child pages on that page.
    is it possible?

  13. 78
    Diego

    I’ve got a question:

    I’m using the <?php echo ddlsp_generate(); ?> bit inside a column on the theme…

    ..but it seems to show on every page, exept for at the very beggining (the “home” or the index.html page)

    Any suggestions to make it appear also on the very home page??

    I will be forever grateful to anyone who can assist me with this!

    Many thanks.

  14. I have found a simple solution for those who wish to put the list even when we are on a subpage.

    After the ddlsp code, just add the wp list pages code with depth of 2 to show the 1st level page and 2nd level page directory.

    
    <?php echo ddlsp_generate(); ?>
    <?php wp_list_pages("title_li=&child_of=$parent&depth=2" ); ?>
    

    An example of which I created for my website below :-

    http://www.mynetbizz.com/travelweb

  15. 76
    Reino

    I’ve a question, is there an option that the plugin will show the active page. Right now when you have 2 subpages under a page like “about”, you click a subpage and the menu will dissapear? Or am i wrong?

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.