diff --git a/class-unlist-posts-admin.php b/class-unlist-posts-admin.php index 3721827..3adea69 100644 --- a/class-unlist-posts-admin.php +++ b/class-unlist-posts-admin.php @@ -38,34 +38,18 @@ public static function instance() { * Constructor */ private function __construct() { - add_action( 'add_meta_boxes', array( $this, 'register_metabox' ) ); + add_action( 'post_submitbox_misc_actions', array( $this, 'metabox_render' ) ); add_action( 'save_post', array( $this, 'save_meta' ) ); } - /** - * Register meta box(es). - */ - function register_metabox() { - $args = array( - 'public' => true, - ); - - $post_types = get_post_types( $args, 'names', 'and' ); - - add_meta_box( - 'ehf-meta-box', __( 'Unlist Post', 'unlist-posts' ), array( - $this, - 'metabox_render', - ), $post_types, 'side', 'high' - ); - } - /** * Render Meta field. * - * @param POST $post Currennt post object which is being displayed. + * @return void */ - function metabox_render( $post ) { + function metabox_render() { + + global $post; $hidden_posts = get_option( 'unlist_posts', array() ); @@ -82,12 +66,13 @@ function metabox_render( $post ) { // We'll use this nonce field later on when saving. wp_nonce_field( 'unlist_post_nounce', 'unlist_post_nounce' ); ?> -
- -
-+
+ +
+