From c701b9129a536253551079d439a1e19a9bc059d7 Mon Sep 17 00:00:00 2001 From: Ryan Boren Date: Sat, 9 Oct 2004 02:03:37 +0000 Subject: [PATCH] wp_list_pages(), first draft git-svn-id: https://develop.svn.wordpress.org/trunk@1766 602fd350-edb4-49c9-b593-d223f7449a82 --- wp-includes/template-functions-post.php | 26 +++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/wp-includes/template-functions-post.php b/wp-includes/template-functions-post.php index ccd8cd6173..fc2bdc40f3 100644 --- a/wp-includes/template-functions-post.php +++ b/wp-includes/template-functions-post.php @@ -314,4 +314,30 @@ function the_meta() { } } + +// +// Pages +// + +function wp_list_pages($args = '') { + global $wpdb; + + // TODO: Hierarchy. + + parse_str($args, $r); + if (!isset($r['sort_column'])) $r['sort_column'] = 'title'; + if (!isset($r['sort_order'])) $r['sort_order'] = 'asc'; + + $pages = $wpdb->get_results("SELECT ID, post_title FROM $wpdb->posts WHERE post_status = 'static' ORDER BY post_" . $r['sort_column'] . " " . $r['sort_order'] = 'asc'); + + foreach ($pages as $page) { + echo '
  • '; + + $title = apply_filters('the_title', $page->post_title); + + echo '' . $title . ''; + echo '
  • '; + } +} + ?> \ No newline at end of file