WordPress admin screen tweaks
| blogging, geek, kaizen, wordpressA few months ago, I decided to experiment with publishing (mostly) one post a day, scheduling posts to go out at 8 AM. That’s been working well for me, although I now have a backlog of 22 scheduled posts (as of March 11), and I keep reshuffling my queue because I want to post some things sooner.
I started using the Manage Posts page a lot. I checked the dates in the queue and used quick-edit to move posts around. I double-checked missed posts (grr). I looked up posts that got scheduled at 8 PM instead of 8 AM.
And then I decided to code in a whole bunch of things that would make life a little bit easier for me. =) I got rid of columns I didn’t use, increased the number of posts per page, added a few custom columns, and styled things differently. Kaizen: relentless improvement!
Just in case I find this useful in the future, or someone else wants to do something similar:
<?php /** * @package Sacha_Chua * @author Sacha Chua * @version 0.1 * Feel free to use this under the GNU General Public License v3 * or the Creative Commons Attribution License * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ /* Plugin Name: Sacha Chua's fixes Plugin URI: https://sachachua.com/# Description: Tweaks to make my life easier Author: Sacha Chua Version: 0.1 Author URI: https://sachachua.com/ */ add_filter('manage_posts_columns', 'sacha_manage_posts_columns'); add_action('manage_posts_custom_column', 'sacha_manage_posts_custom_column'); add_action('admin_head', 'sacha_admin_head'); add_filter('edit_posts_per_page', 'sacha_edit_posts_per_page'); define('POSTS_PER_PAGE', 50); /** * Increase posts per page to at least POSTS_PER_PAGE */ function sacha_edit_posts_per_page($page) { return ($page < POSTS_PER_PAGE) ? POSTS_PER_PAGE : $page; } /** * Resize the columns */ function sacha_admin_head() { ?> <style type="text/css"> .column-time { width: 150px; } .column-categories { width: 300px } .column-status { width: 100px } .scheduled { color: green } </style> <?php } /** * Remove the tags column */ function sacha_manage_posts_columns($defaults) { unset($defaults['tags']); unset($defaults['author']); unset($defaults['date']); $defaults['status'] = __('Status'); $defaults['time'] = __('Date'); return $defaults; } /** * Show the time if it's not 8 AM, and show the status and date */ function sacha_manage_posts_custom_column($column_name) { global $post; switch ($column_name) { case 'status': if ( '0000-00-00 00:00:00' == $post->post_date) { _e('Unpublished'); } elseif ('publish' == $post->post_status) { echo '<div class="published">' . __('Published') . '</div>'; } elseif ('future' == $post->post_status) { $time_diff = time() - get_post_time('G', true, $post); if ( $time_diff > 0 ) { echo '<strong class="attention">' . __('Missed schedule') . '</strong>'; } else { echo '<div class="scheduled">' . __('Scheduled') . '</div>'; } } else { _e('Last Modified'); } break; case 'time': if ( '0000-00-00 00:00:00' != $post->post_date) { $t_time = get_the_time(__('g:i A')); if ($t_time == '8:00 AM') { $t_time = ''; } $t_date = get_the_time(__('Y/m/d')); print $t_date . ' ' . $t_time; } } } ?>
Next step might be to make a plugin that automatically handles scheduling for me. Or even rearranging my queue… Hmm… =)