Pages+プラグイン

複数の人間で(staticな)ページを書いていると、いつ書き換えられたかわかりにくい。管理画面で更新日時順にできればいいのだが、と思ってプラグインを探してみた。そのものではないが Pages+ をほんの少し直せば目的に合いそうだ。slug は要らないので削って、post_author, post_modified をつけ加えた。

DIFF:
  1. @@ -131,7 +134,9 @@
  2.     $sort_cols = array(
  3.        'menu_order',
  4.        'id',
  5. -      'post_title'
  6. +      'post_title',
  7. +      'post_author',
  8. +      'post_modified'
  9.     );
  10.     
  11.     $sort_orders = array(
  12. @@ -142,7 +147,7 @@
  13.     $orderby = (!array_key_exists('orderby', $_GET) || !in_array(strtolower($_GET['orderby']), $sort_cols)) ? 'menu_order' : $_GET['orderby'];
  14.     $sortorder = (!array_key_exists('sortorder', $_GET) || !in_array(strtolower($_GET['sortorder']), $sort_orders)) ? 'ASC' : $_GET['sortorder'];
  15.     
  16. -   $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";
  17. +   $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";
  18.     $rows = $wpdb->get_results($sql);
  19.     $num_rows = count($rows);
  20.     ?>
  21. @@ -166,6 +171,18 @@
  22.        <?php } else { ?>
  23.           Title
  24.        <?php } ?>
  25. +      &nbsp;|&nbsp;
  26. +      <?php if($orderby != 'post_author') {?>
  27. +         <a href="<?php echo pp_link_self($parent_id, array('orderby'=>'post_author')); ?>" title="Order by Author">Author</a>
  28. +      <?php } else { ?>
  29. +         Author
  30. +      <?php } ?>
  31. +      &nbsp;|&nbsp;
  32. +      <?php if($orderby != 'post_modified') {?>
  33. +         <a href="<?php echo pp_link_self($parent_id, array('orderby'=>'post_modified')); ?>" title="Order by mod-time">Upd Time</a>
  34. +      <?php } else { ?>
  35. +         Upd Time
  36. +      <?php } ?>
  37.        <br />
  38.        <strong>Sort order:</strong>
  39.        <?php if($sortorder != 'ASC') {?>
  40. @@ -193,7 +210,8 @@
  41.              
  42.              <th scope="col">Order</th>
  43.              <th scope="col">Title</th>
  44. -            <th scope="col">Slug</th>
  45. +            <th scope="col">Owner</th>
  46. +            <th scope="col">Updated</th>
  47.              <th scope="col"></th>
  48.              <th scope="col"></th>
  49.              <th scope="col"></th>
  50. @@ -222,7 +240,8 @@
  51.              } else {
  52.                 echo "<td>$row->post_title</td>n";
  53.              }
  54. -            echo "<td>$row->post_name</td>n";
  55. +            echo "<td>" . get_author_name($row->post_author) . "</td>n";
  56. +            echo "<td>$row->post_modified</td>n";
  57.              if(function_exists(get_guid))
  58.              {
  59.                 // if available, makes use of the 'Guid Rebuild' plugin (also by me!)

関連する投稿

カテゴリー: WordPress   タグ: ,   この投稿のパーマリンク

コメントをどうぞ

メールアドレスが公開されることはありません。

次のHTML タグと属性が使えます: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>