'); add_option('ddlsp_after_list', ''); add_option('ddlsp_sort_column', 'post_title'); add_option('ddlsp_sort_order', 'asc'); add_option('ddlsp_exclude', ''); add_option('ddlsp_include', ''); add_option('ddlsp_depth', 1); add_option('ddlsp_show_date', TRUE); add_option('ddlsp_date_format', 'l, F j, Y'); add_option('ddlsp_title_li', ''); function ddlsp_add_option_pages() { if (function_exists('add_options_page')) { add_options_page('List Subpages', 'DDListSubpages', 8, __FILE__, 'ddlsp_options_page'); } } function ddlsp_options_page() { global $ddlsp_ver; if (isset($_POST['set_defaults'])) { echo '

'; update_option('ddlsp_before_list', '

'); update_option('ddlsp_sort_column', 'post_title'); update_option('ddlsp_sort_order', 'asc'); update_option('ddlsp_exclude', ''); update_option('ddlsp_include', ''); update_option('ddlsp_depth', 1); update_option('ddlsp_show_date', TRUE); update_option('ddlsp_date_format', 'l, F j, Y'); update_option('ddlsp_title_li', ''); echo 'Default Options Loaded!'; echo '

'; } else if (isset($_POST['info_update'])) { echo '

'; update_option('ddlsp_before_list', stripslashes((string)$_POST['ddlsp_before_list'])); update_option('ddlsp_after_list', stripslashes((string)$_POST['ddlsp_after_list'])); update_option('ddlsp_sort_column', stripslashes((string)$_POST['ddlsp_sort_column'])); update_option('ddlsp_sort_order', stripslashes((string)$_POST['ddlsp_sort_order'])); update_option('ddlsp_exclude', stripslashes((string)$_POST['ddlsp_exclude'])); update_option('ddlsp_include', stripslashes((string)$_POST['ddlsp_include'])); update_option('ddlsp_depth', stripslashes((string)$_POST['ddlsp_depth'])); update_option('ddlsp_show_date', (bool)$_POST['ddlsp_show_date']); update_option('ddlsp_date_format', stripslashes((string)$_POST['ddlsp_date_format'])); update_option('ddlsp_title_li', stripslashes((string)$_POST['ddlsp_title_li'])); echo 'Configuration Updated!'; echo '

'; } ?>

List Subpages

To check for new versions or get more information, visit this plugin's page.

">
Usage

There are two ways you can use this plugin:

  1. Add the trigger text <!-- ddlsp --> to a page
  2. Call the function from a template file: <?php echo ddlsp_generate(); ?>
Options
Before List
Added before the list of pages
After List
Added after the list of pages
Sort Column />   Page Title
/>   Menu Order
/>   Page Date
/>   Page Modified
/>   Page ID
/>   Page Author
/>   Page Name (slug)
Sort Order />   Ascending
/>   Descending
Excluded Items
Comma-separated list of page IDs to exclude from the list
Included Items
Comma-separated list of page IDs to only include
Page Depth
(use 0 for no limit)
Show Date />   If enabled, the date is shown after each page listed
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
post->ID; $opt = array(); $opt[] = "echo=0"; $opt[] = "child_of=" . $thePostID; $opt[] = "sort_column=" . $sort_column; $opt[] = "sort_order=" . $sort_order; if ($exclude != '') { $opt[] = "exclude=" . $exclude; } if ($include != '') { $opt[] = "include=" . $include; } if ($depth == '') $depth = 1; $opt[] = "depth=" . $depth; if ($show_date) { $opt[] = "show_date=true"; if ($date_format != '') { $opt[] = "date_format=" . $date_format; } } $opt[] = "title_li=" . $title_li; $opt_string = implode('&', $opt); $t_out .= wp_list_pages($opt_string); if (trim($t_out) != '') { $t_out = $before_list . $t_out . $after_list; } } return $t_out; } function ddlsp_process($content) { if (strpos($content, "") !== FALSE) { $content = preg_replace('/

\s*\s*<\/p>/i', "", $content); $content = str_replace("", ddlsp_generate(), $content); } return $content; } add_filter('the_content', 'ddlsp_process'); add_action('admin_menu', 'ddlsp_add_option_pages'); ?>