| | 317 | |
|---|
| | 318 | // |
|---|
| | 319 | // Pages |
|---|
| | 320 | // |
|---|
| | 321 | |
|---|
| | 322 | function wp_list_pages($args = '') { |
|---|
| | 323 | global $wpdb; |
|---|
| | 324 | |
|---|
| | 325 | // TODO: Hierarchy. |
|---|
| | 326 | |
|---|
| | 327 | parse_str($args, $r); |
|---|
| | 328 | if (!isset($r['sort_column'])) $r['sort_column'] = 'title'; |
|---|
| | 329 | if (!isset($r['sort_order'])) $r['sort_order'] = 'asc'; |
|---|
| | 330 | |
|---|
| | 331 | $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'); |
|---|
| | 332 | |
|---|
| | 333 | foreach ($pages as $page) { |
|---|
| | 334 | echo '<li>'; |
|---|
| | 335 | |
|---|
| | 336 | $title = apply_filters('the_title', $page->post_title); |
|---|
| | 337 | |
|---|
| | 338 | echo '<a href="' . get_page_link($page->ID) . '" title="' . htmlspecialchars($title) . '">' . $title . '</a>'; |
|---|
| | 339 | echo '</li>'; |
|---|
| | 340 | } |
|---|
| | 341 | } |
|---|
| | 342 | |
|---|