A fork of Ryan Summer's WordPress plugin Obvious Post States (https://github.com/ryansommers/obvious-post-states)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

33 lines
1.1 KiB

10 years ago
10 years ago
10 years ago
10 years ago
  1. <?php
  2. /*
  3. Plugin Name: Obvious Post States
  4. Plugin URI: http://sevenbold.com/wordpress/
  5. Description: Make your WordPress post state text (draft, pending, sticky, etc) stand out.
  6. Author: Ryan Sommers
  7. Version: 1.0.3
  8. Author URI: http://ryansommers.com
  9. */
  10. function obvious_post_states_files() {
  11. wp_enqueue_style( 'obvious-post-states', plugins_url('obvious-post-states.css', __FILE__) );
  12. wp_enqueue_script( 'obvious-post-states', plugins_url( "js/obvious-post-states.js", __FILE__ ), array( 'jquery' ), '1.0.0', true );
  13. }
  14. add_action( 'admin_enqueue_scripts', 'obvious_post_states_files' );
  15. add_action( 'login_enqueue_scripts', 'obvious_post_states_files' );
  16. // Remove the hyphen before the post state
  17. add_filter( 'display_post_states', 'obvious_post_states_post_state' );
  18. function obvious_post_states_post_state( $post_states ) {
  19. if ( !empty($post_states) ) {
  20. $state_count = count($post_states);
  21. $i = 0;
  22. foreach ( $post_states as $state ) {
  23. ++$i;
  24. ( $i == $state_count ) ? $sep = '' : $sep = '';
  25. echo "<span class='post-state'>$state$sep</span>";
  26. }
  27. }
  28. }
  29. ?>