Skip to content

Instantly share code, notes, and snippets.

@mattwiebe
Created February 23, 2012 17:53
Show Gist options
  • Save mattwiebe/1894025 to your computer and use it in GitHub Desktop.
Save mattwiebe/1894025 to your computer and use it in GitHub Desktop.
Highlight Scheduled Posts
<?php
/*
Plugin Name: Highlight Scheduled Posts
Plugin URI: http://somadesign.ca/
Description: Highlight scheduled posts in the admin
Version: 0.1
Author: Matt Wiebe
Author URI: http://somadesign.ca/
*/
/**
* Copyright (c) 2012 Matt Wiebe. All rights reserved.
*
* Released under the GPL license
* http://www.opensource.org/licenses/gpl-license.php
*
* This is an add-on for WordPress
* http://wordpress.org/
*
* **********************************************************************
* 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 2 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.
* **********************************************************************
*/
add_action( 'load-edit.php', 'hsp_add_actions' );
function hsp_add_actions() {
add_filter( 'post_class', 'hsp_post_class', 10, 3 );
add_action( 'admin_print_styles', 'hsp_style' );
}
function hsp_post_class($classes, $class, $post_id) {
$status = get_post_status($post_id);
if ( 'future' === $status ) {
$classes[] = 'hsp-scheduled';
}
return $classes;
}
function hsp_style() { ?>
<style> .wp-list-table .hsp-scheduled { background-color: #eaf8ff; } </style>
<?php
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment