Make WordPress Core


Ignore:
Timestamp:
02/21/2006 08:39:58 AM (18 years ago)
Author:
ryan
Message:

Allow queries by post type. Enable paging in Manage->Pages

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/admin-functions.php

    r3563 r3564  
    644644}
    645645
    646 function page_rows($parent = 0, $level = 0, $pages = 0) {
     646function page_rows($parent = 0, $level = 0, $pages = 0, $hierarchy = true) {
    647647    global $wpdb, $class, $post;
     648
    648649    if (!$pages)
    649650        $pages = $wpdb->get_results("SELECT * FROM $wpdb->posts WHERE post_type = 'page' ORDER BY menu_order");
    650651
    651     if ($pages) {
    652         foreach ($pages as $post) {
    653             start_wp();
    654             if ($post->post_parent == $parent) {
    655                 $post->post_title = wp_specialchars($post->post_title);
    656                 $pad = str_repeat('— ', $level);
    657                 $id = $post->ID;
    658                 $class = ('alternate' == $class) ? '' : 'alternate';
     652    if (! $pages)
     653        return false;
     654
     655    foreach ($pages as $post) {
     656        setup_postdata($post);
     657        if ( $hierarchy && ($post->post_parent != $parent) )
     658            continue;
     659
     660        $post->post_title = wp_specialchars($post->post_title);
     661        $pad = str_repeat('— ', $level);
     662        $id = $post->ID;
     663        $class = ('alternate' == $class) ? '' : 'alternate';
    659664?>
    660665  <tr id='page-<?php echo $id; ?>' class='<?php echo $class; ?>'>
     
    671676
    672677<?php
    673 
    674                 page_rows($id, $level +1, $pages);
    675             }
    676         }
    677     } else {
    678         return false;
     678        if ( $hierarchy) page_rows($id, $level + 1, $pages);
    679679    }
    680680}
Note: See TracChangeset for help on using the changeset viewer.