From 3c360863aea11f409ba5a8165d2248a82556b245 Mon Sep 17 00:00:00 2001 From: rboren Date: Sat, 9 Oct 2004 02:03:37 +0000 Subject: [PATCH] wp_list_pages(), first draft git-svn-id: http://svn.automattic.com/wordpress/trunk@1766 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- 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