Allow queries by post type. Enable paging in Manage->Pages
git-svn-id: http://svn.automattic.com/wordpress/trunk@3564 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
@@ -643,19 +643,24 @@ function cat_rows($parent = 0, $level = 0, $categories = 0) {
|
||||
}
|
||||
}
|
||||
|
||||
function page_rows($parent = 0, $level = 0, $pages = 0) {
|
||||
function page_rows($parent = 0, $level = 0, $pages = 0, $hierarchy = true) {
|
||||
global $wpdb, $class, $post;
|
||||
|
||||
if (!$pages)
|
||||
$pages = $wpdb->get_results("SELECT * FROM $wpdb->posts WHERE post_type = 'page' ORDER BY menu_order");
|
||||
|
||||
if ($pages) {
|
||||
foreach ($pages as $post) {
|
||||
start_wp();
|
||||
if ($post->post_parent == $parent) {
|
||||
$post->post_title = wp_specialchars($post->post_title);
|
||||
$pad = str_repeat('— ', $level);
|
||||
$id = $post->ID;
|
||||
$class = ('alternate' == $class) ? '' : 'alternate';
|
||||
if (! $pages)
|
||||
return false;
|
||||
|
||||
foreach ($pages as $post) {
|
||||
setup_postdata($post);
|
||||
if ( $hierarchy && ($post->post_parent != $parent) )
|
||||
continue;
|
||||
|
||||
$post->post_title = wp_specialchars($post->post_title);
|
||||
$pad = str_repeat('— ', $level);
|
||||
$id = $post->ID;
|
||||
$class = ('alternate' == $class) ? '' : 'alternate';
|
||||
?>
|
||||
<tr id='page-<?php echo $id; ?>' class='<?php echo $class; ?>'>
|
||||
<th scope="row"><?php echo $post->ID; ?></th>
|
||||
@@ -670,12 +675,7 @@ function page_rows($parent = 0, $level = 0, $pages = 0) {
|
||||
</tr>
|
||||
|
||||
<?php
|
||||
|
||||
page_rows($id, $level +1, $pages);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
return false;
|
||||
if ( $hierarchy) page_rows($id, $level + 1, $pages);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -19,13 +19,12 @@ require_once('admin-header.php');
|
||||
</form>
|
||||
|
||||
<?php
|
||||
wp('post_type=page&orderby=menu_order&what_to_show=posts&posts_per_page=15&posts_per_archive_page=-1');
|
||||
|
||||
$show_post_type = 'page';
|
||||
|
||||
if ( isset($_GET['s']) )
|
||||
wp();
|
||||
if ( $_GET['s'] )
|
||||
$all = false;
|
||||
else
|
||||
$posts = $wpdb->get_results("SELECT * FROM $wpdb->posts WHERE post_type = 'page'");
|
||||
$all = true;
|
||||
|
||||
if ($posts) {
|
||||
?>
|
||||
@@ -40,30 +39,17 @@ if ($posts) {
|
||||
<th scope="col"></th>
|
||||
</tr>
|
||||
<?php
|
||||
if ( isset($_GET['s']) ) {
|
||||
foreach ( $posts as $post ) :
|
||||
$class = ('alternate' != $class) ? 'alternate' : ''; ?>
|
||||
<tr id='page-<?php echo $post->ID; ?>' class='<?php echo $class; ?>'>
|
||||
<th scope="row"><?php echo $post->ID; ?></th>
|
||||
<td>
|
||||
<?php echo $pad; ?><?php the_title() ?>
|
||||
</td>
|
||||
<td><?php the_author() ?></td>
|
||||
<td><?php echo mysql2date('Y-m-d g:i a', $post->post_modified); ?></td>
|
||||
<td><a href="<?php the_permalink(); ?>" rel="permalink" class="edit"><?php _e('View'); ?></a></td>
|
||||
<td><?php if ( current_user_can('edit_page', $post->ID) ) { echo "<a href='page.php?action=edit&post=$post->ID' class='edit'>" . __('Edit') . "</a>"; } ?></td>
|
||||
<td><?php if ( current_user_can('delete_page', $post->ID) ) { echo "<a href='page.php?action=delete&post=$post->ID' class='delete' onclick=\"return deleteSomething( 'page', " . $id . ", '" . sprintf(__("You are about to delete the "%s" page.\\n"OK" to delete, "Cancel" to stop."), wp_specialchars(get_the_title('','',0), 1)) . "' );\">" . __('Delete') . "</a>"; } ?></td>
|
||||
</tr>
|
||||
<?php
|
||||
endforeach;
|
||||
} else {
|
||||
page_rows();
|
||||
}
|
||||
page_rows(0, 0, $posts, $all);
|
||||
?>
|
||||
</table>
|
||||
|
||||
<div id="ajax-response"></div>
|
||||
|
||||
<div class="navigation">
|
||||
<div class="alignleft"><?php next_posts_link(__('« Previous Entries')) ?></div>
|
||||
<div class="alignright"><?php previous_posts_link(__('Next Entries »')) ?></div>
|
||||
</div>
|
||||
|
||||
<?php
|
||||
} else {
|
||||
?>
|
||||
|
||||
@@ -55,11 +55,8 @@ if ($drafts || $other_drafts) {
|
||||
<div class="wrap">
|
||||
<h2>
|
||||
<?php
|
||||
$what_to_show = 'posts';
|
||||
$posts_per_page = 15;
|
||||
$posts_per_archive_page = -1;
|
||||
|
||||
wp();
|
||||
wp('what_to_show=posts&posts_per_page=15&posts_per_archive_page=-1');
|
||||
|
||||
if ( is_month() ) {
|
||||
single_month_title(' ');
|
||||
|
||||
Reference in New Issue
Block a user