複数の人間で(staticな)ページを書いていると、いつ書き換えられたかわかりにくい。管理画面で更新日時順にできればいいのだが、と思ってプラグインを探してみた。そのものではないが
Pages+ をほんの少し直せば目的に合いそうだ。slug は要らないので削って、post_author, post_modified をつけ加えた。
@@ -131,7 +134,9 @@
$sort_cols = array(
'menu_order',
'id',
- 'post_title'
+ 'post_title',
+ 'post_author',
+ 'post_modified'
);
$sort_orders = array(
@@ -142,7 +147,7 @@
$orderby = (!array_key_exists('orderby', $_GET) || !in_array(strtolower($_GET['orderby']), $sort_cols)) ? 'menu_order' : $_GET['orderby'];
$sortorder = (!array_key_exists('sortorder', $_GET) || !in_array(strtolower($_GET['sortorder']), $sort_orders)) ? 'ASC' : $_GET['sortorder'];
- $sql = "SELECT ID, menu_order, post_title, post_name, guid FROM $wpdb->posts WHERE post_parent = $parent_id AND post_status = 'static' ORDER BY $orderby $sortorder";
+ $sql = "SELECT ID, menu_order, post_title, post_name, guid, post_author, post_modified FROM $wpdb->posts WHERE post_parent = $parent_id AND post_status = 'static' ORDER BY $orderby $sortorder";
$rows = $wpdb->get_results($sql);
$num_rows = count($rows);
?>
@@ -166,6 +171,18 @@
< ?php } else { ?>
Title
< ?php } ?>
+ |
+ < ?php if($orderby != 'post_author') {?>
+ <a href="<?php echo pp_link_self($parent_id, array('orderby'=>'post_author')); ?>" title="Order by Author">Author</a>
+ < ?php } else { ?>
+ Author
+ < ?php } ?>
+ |
+ < ?php if($orderby != 'post_modified') {?>
+ <a href="<?php echo pp_link_self($parent_id, array('orderby'=>'post_modified')); ?>" title="Order by mod-time">Upd Time</a>
+ < ?php } else { ?>
+ Upd Time
+ < ?php } ?>
<br />
<strong>Sort order:</strong>
< ?php if($sortorder != 'ASC') {?>
@@ -193,7 +210,8 @@
<th scope="col">Order</th>
<th scope="col">Title</th>
- <th scope="col">Slug</th>
+ <th scope="col">Owner</th>
+ <th scope="col">Updated</th>
<th scope="col"></th>
<th scope="col"></th>
<th scope="col"></th>
@@ -222,7 +240,8 @@
} else {
echo "<td>$row->post_title</td>n";
}
- echo "<td>$row->post_name</td>n";
+ echo "<td>" . get_author_name($row->post_author) . "</td>n";
+ echo "<td>$row->post_modified</td>n";
if(function_exists(get_guid))
{
// if available, makes use of the 'Guid Rebuild' plugin (also by me!)