Changeset 1766

Show
Ignore:
Timestamp:
10/09/04 02:03:37 (4 years ago)
Author:
rboren
Message:

wp_list_pages(), first draft

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/wp-includes/template-functions-post.php

    r1519 r1766  
    315315} 
    316316 
     317 
     318// 
     319// Pages 
     320// 
     321 
     322function 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 
    317343?>