Show IDs by 99 Robots - Version 1.1.2

Version Description

2017-06-11 * Made compatible with WordPress 4.8

Download this release

Release Info

Developer 99robots
Plugin Icon 128x128 Show IDs by 99 Robots
Version 1.1.2
Comparing to
See all releases

Code changes from version 1.1.0 to 1.1.2

Files changed (2) hide show
  1. readme.txt +9 -3
  2. wpsite-show-ids.php +73 -72
readme.txt CHANGED
@@ -3,8 +3,8 @@ Contributors: 99robots, kjbenk, charliepatel
3
  Donate link:
4
  Tags: ID, show id, display id, show post id, display post id, reveal id, reveal post id, post, category, media, page, post type, post id, category id, media id, page id, post type id, comments, comment id, custom post type id, link id, show, display, reveal, taxonomy, taxonomy id, wordpress id, wp id, user, user id, tag, tag id, wp-admin
5
  Requires at least: 4.0
6
- Tested up to: 4.3.1
7
- Stable tag: 1.1.0
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -63,6 +63,12 @@ You can install the **Show IDs** plugin from your WordPress Dashboard or manuall
63
 
64
  == Changelog ==
65
 
 
 
 
 
 
 
66
  = 1.1.0 = 2015-10-16
67
  * UPDATED: Readme file description
68
 
@@ -82,4 +88,4 @@ You can install the **Show IDs** plugin from your WordPress Dashboard or manuall
82
  * Minor Updates
83
 
84
  = 1.0 =
85
- * Initial Commit
3
  Donate link:
4
  Tags: ID, show id, display id, show post id, display post id, reveal id, reveal post id, post, category, media, page, post type, post id, category id, media id, page id, post type id, comments, comment id, custom post type id, link id, show, display, reveal, taxonomy, taxonomy id, wordpress id, wp id, user, user id, tag, tag id, wp-admin
5
  Requires at least: 4.0
6
+ Tested up to: 4.8.0
7
+ Stable tag: 1.1.2
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
63
 
64
  == Changelog ==
65
 
66
+ = 1.1.2 = 2017-06-11
67
+ * Made compatible with WordPress 4.8
68
+
69
+ = 1.1.1 = 2015-10-16
70
+ * UPDATED: Banners and Icons
71
+
72
  = 1.1.0 = 2015-10-16
73
  * UPDATED: Readme file description
74
 
88
  * Minor Updates
89
 
90
  = 1.0 =
91
+ * Initial Commit
wpsite-show-ids.php CHANGED
@@ -1,73 +1,72 @@
1
  <?php
2
- /*
3
- Plugin Name: Show IDs
4
- plugin URI: https://99robots.com/products/show-ids/
5
- Description: Show IDs on all post, page and taxonomy pages.
6
- version: 1.1.0
7
- Author: 99 Robots
8
- Author URI: https://99robots.com
9
- License: GPL2
10
- */
11
-
12
- // Hooks + Filters
13
- add_action( 'admin_head', array('WPSiteShowIDs', 'add_css'));
14
-
15
- // For Post Management
16
- add_filter( 'manage_posts_columns', array('WPSiteShowIDs', 'add_column') );
17
- add_action( 'manage_posts_custom_column', array('WPSiteShowIDs', 'add_value'), 10, 2 );
18
-
19
- // For Page Management
20
- add_filter( 'manage_pages_columns', array('WPSiteShowIDs', 'add_column') );
21
- add_action( 'manage_pages_custom_column', array('WPSiteShowIDs', 'add_value'), 10, 2 );
22
-
23
- // For Media Management
24
- add_filter( 'manage_media_columns', array('WPSiteShowIDs', 'add_column') );
25
- add_action( 'manage_media_custom_column', array('WPSiteShowIDs', 'add_value'), 10, 2 );
26
-
27
- // For Link Management
28
- add_filter( 'manage_link-manager_columns', array('WPSiteShowIDs', 'add_column') );
29
- add_action( 'manage_link_custom_column', array('WPSiteShowIDs', 'add_value'), 10, 2 );
30
-
31
- // For Category Management
32
- add_action( 'manage_edit-link-categories_columns', array('WPSiteShowIDs', 'add_column') );
33
- add_filter( 'manage_link_categories_custom_column', array('WPSiteShowIDs', 'add_return_value'), 10, 3 );
34
-
35
- // For User Management
36
- add_action( 'manage_users_columns', array('WPSiteShowIDs', 'add_column') );
37
- add_filter( 'manage_users_custom_column', array('WPSiteShowIDs', 'add_return_value'), 10, 3 );
38
-
39
- // For Comment Management
40
- add_action( 'manage_edit-comments_columns', array('WPSiteShowIDs', 'add_column') );
41
- add_action( 'manage_comments_custom_column', array('WPSiteShowIDs', 'add_value'), 10, 2 );
42
-
43
- add_action('admin_init', array('WPSiteShowIDs', 'custom_objects'));
44
-
45
- class WPSiteShowIDs {
 
46
 
47
  /**
48
  * Hooks to the 'admin_init'
49
  *
50
- * @access public
51
- * @static
52
  * @return void
53
  */
54
- static function custom_objects() {
55
 
56
  // For Custom Taxonomies
57
-
58
- foreach ( get_taxonomies(array('public' => true), 'names') as $custom_taxonomy ) {
59
- if (isset($custom_taxonomy)) {
60
- add_action("manage_edit-" . $custom_taxonomy . "_columns", array('WPSiteShowIDs', 'add_column'));
61
- add_filter("manage_" . $custom_taxonomy . "_custom_column", array('WPSiteShowIDs', 'add_return_value'), 10, 3);
62
  }
63
  }
64
 
65
  // For Custom Post Types
66
-
67
- foreach (get_post_types(array('public' => true ), 'names') as $post_type) {
68
- if (isset($post_type)) {
69
- add_action("manage_edit-". $post_type . "_columns", array('WPSiteShowIDs', 'add_column'));
70
- add_filter("manage_". $post_type . "_custom_column", array('WPSiteShowIDs', 'add_return_value'), 10, 3);
71
  }
72
  }
73
  }
@@ -75,11 +74,9 @@ class WPSiteShowIDs {
75
  /**
76
  * Hooks to 'admin_head'
77
  *
78
- * @access public
79
- * @static
80
  * @return void
81
  */
82
- static function add_css() {
83
  ?>
84
  <style type="text/css">
85
  #wpsite-show-ids {
@@ -92,27 +89,25 @@ class WPSiteShowIDs {
92
  /**
93
  * Adds column to edit screen
94
  *
95
- * @access public
96
- * @static
97
  * @param mixed $cols
98
  * @return void
99
  */
100
- static function add_column($cols) {
 
101
  $cols['wpsite-show-ids'] = 'ID';
 
102
  return $cols;
103
  }
104
 
105
  /**
106
  * Adds id value
107
  *
108
- * @access public
109
- * @static
110
  * @param mixed $column_name
111
  * @param mixed $id
112
  * @return void
113
  */
114
- static function add_value($column_name, $id) {
115
- if ( $column_name == 'wpsite-show-ids' ) {
116
  echo $id;
117
  }
118
  }
@@ -120,17 +115,23 @@ class WPSiteShowIDs {
120
  /**
121
  * Adds id value
122
  *
123
- * @access public
124
- * @static
125
  * @param mixed $value
126
  * @param mixed $column_name
127
  * @param mixed $id
128
  * @return void
129
  */
130
- static function add_return_value($value, $column_name, $id) {
131
- if ( $column_name == 'wpsite-show-ids' ) {
 
132
  $value = $id;
133
  }
 
134
  return $value;
135
  }
136
- }
 
 
 
 
 
 
1
  <?php
2
+ /**
3
+ * Plugin Name: Show IDs
4
+ * Plugin URI: https://99robots.com/products/show-ids/
5
+ * Description: Show IDs on all post, page and taxonomy pages.
6
+ * Version: 1.1.2
7
+ * Author: 99 Robots
8
+ * Author URI: https://99robots.com
9
+ * License: GPL2
10
+ */
11
+
12
+ class WPSite_Show_IDs {
13
+
14
+ public function __construct() {
15
+
16
+ add_action( 'admin_init', array( $this, 'custom_objects' ) );
17
+ add_action( 'admin_head', array( $this, 'add_css' ) );
18
+
19
+ // For Post Management
20
+ add_filter( 'manage_posts_columns', array( $this, 'add_column' ) );
21
+ add_action( 'manage_posts_custom_column', array( $this, 'add_value' ), 10, 2 );
22
+
23
+ // For Page Management
24
+ add_filter( 'manage_pages_columns', array( $this, 'add_column' ) );
25
+ add_action( 'manage_pages_custom_column', array( $this, 'add_value' ), 10, 2 );
26
+
27
+ // For Media Management
28
+ add_filter( 'manage_media_columns', array( $this, 'add_column' ) );
29
+ add_action( 'manage_media_custom_column', array( $this, 'add_value' ), 10, 2 );
30
+
31
+ // For Link Management
32
+ add_filter( 'manage_link-manager_columns', array( $this, 'add_column' ) );
33
+ add_action( 'manage_link_custom_column', array( $this, 'add_value' ), 10, 2 );
34
+
35
+ // For Category Management
36
+ add_action( 'manage_edit-link-categories_columns', array( $this, 'add_column' ) );
37
+ add_filter( 'manage_link_categories_custom_column', array( $this, 'add_return_value' ), 10, 3 );
38
+
39
+ // For User Management
40
+ add_action( 'manage_users_columns', array( $this, 'add_column' ) );
41
+ add_filter( 'manage_users_custom_column', array( $this, 'add_return_value' ), 10, 3 );
42
+
43
+ // For Comment Management
44
+ add_action( 'manage_edit-comments_columns', array( $this, 'add_column' ) );
45
+ add_action( 'manage_comments_custom_column', array( $this, 'add_value' ), 10, 2 );
46
+ }
47
 
48
  /**
49
  * Hooks to the 'admin_init'
50
  *
 
 
51
  * @return void
52
  */
53
+ public function custom_objects() {
54
 
55
  // For Custom Taxonomies
56
+ $taxonomies = get_taxonomies( array( 'public' => true ), 'names' );
57
+ foreach ( $taxonomies as $custom_taxonomy ) {
58
+ if ( isset( $custom_taxonomy ) ) {
59
+ add_action( 'manage_edit-' . $custom_taxonomy . '_columns', array( $this, 'add_column' ) );
60
+ add_filter( 'manage_' . $custom_taxonomy . '_custom_column', array( $this, 'add_return_value' ), 10, 3 );
61
  }
62
  }
63
 
64
  // For Custom Post Types
65
+ $post_types = get_post_types( array( 'public' => true ), 'names' );
66
+ foreach ( $post_types as $post_type ) {
67
+ if ( isset( $post_type ) ) {
68
+ add_action( 'manage_edit-' . $post_type . '_columns', array( $this, 'add_column' ) );
69
+ add_filter( 'manage_' . $post_type . '_custom_column', array( $this, 'add_return_value' ), 10, 3 );
70
  }
71
  }
72
  }
74
  /**
75
  * Hooks to 'admin_head'
76
  *
 
 
77
  * @return void
78
  */
79
+ public function add_css() {
80
  ?>
81
  <style type="text/css">
82
  #wpsite-show-ids {
89
  /**
90
  * Adds column to edit screen
91
  *
 
 
92
  * @param mixed $cols
93
  * @return void
94
  */
95
+ public function add_column( $cols ) {
96
+
97
  $cols['wpsite-show-ids'] = 'ID';
98
+
99
  return $cols;
100
  }
101
 
102
  /**
103
  * Adds id value
104
  *
 
 
105
  * @param mixed $column_name
106
  * @param mixed $id
107
  * @return void
108
  */
109
+ public function add_value( $column_name, $id ) {
110
+ if ( 'wpsite-show-ids' === $column_name ) {
111
  echo $id;
112
  }
113
  }
115
  /**
116
  * Adds id value
117
  *
 
 
118
  * @param mixed $value
119
  * @param mixed $column_name
120
  * @param mixed $id
121
  * @return void
122
  */
123
+ public function add_return_value( $value, $column_name, $id ) {
124
+
125
+ if ( 'wpsite-show-ids' === $column_name ) {
126
  $value = $id;
127
  }
128
+
129
  return $value;
130
  }
131
+ }
132
+
133
+ /**
134
+ * Start
135
+ * @var WPSite_Show_IDs
136
+ */
137
+ new WPSite_Show_IDs;