Plugin Directory

Changeset 1340949


Ignore:
Timestamp:
02/01/2016 09:31:16 PM (10 years ago)
Author:
LinSoftware
Message:

Fixed issue with meta box appearing on published posts.

Location:
lsw-organize-drafts/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • lsw-organize-drafts/trunk/lsw_organize_drafts.php

    r1339338 r1340949  
    88* Author: Linnea Wilhelm
    99* Author URI: http://www.linsoftware.com
    10 * Version: 1.0.0
     10* Version: 1.0.1
    1111* License: GPL2
    1212* License URI: https://www.gnu.org/licenses/gpl-2.0.html
     
    2626     * @var string
    2727     */
    28     public $version = '1.0.0';
     28    public $version = '1.0.1';
    2929
    3030    /**
     
    7474        add_filter('manage_posts_columns' , array('LSW_Organize_Drafts', 'control_columns'));
    7575        add_filter('manage_pages_columns' , array('LSW_Organize_Drafts', 'control_columns'));
    76         add_action('admin_menu',  array('LSW_Organize_Drafts', 'update_meta_boxes'));
     76        add_action('add_meta_boxes', array('LSW_Organize_Drafts','update_meta_boxes'), 20, 2 );
    7777        add_action('save_post', array('LSW_Organize_Drafts', 'save_taxonomy_data'), 10, 2);
    7878        $post_types = apply_filters('lsw_default_post_types', LSW_Organize_Drafts::$post_types);
     
    115115
    116116
    117 
    118     public static function update_meta_boxes() {
     117    public static function update_meta_boxes($post_type, $post) {
     118
    119119        $post_types = apply_filters('lsw_default_post_types', LSW_Organize_Drafts::$post_types);
    120120        remove_meta_box( 'tagsdiv-lswdrafttype', $post_types, 'side' );
    121         add_meta_box('lswdrafttype_custom', __('Draft Type', 'lsw_organize_drafts'), array('LSW_Organize_Drafts',
    122                 'render_meta_box'), $post_types, 'side', 'core');
     121        if (isset($post->post_status) && ($post->post_status == 'draft' || $post->post_status == 'auto-draft')) {
     122            add_meta_box('lswdrafttype_custom', __('Draft Type', 'lsw_organize_drafts'), array('LSW_Organize_Drafts','render_meta_box'), $post_types, 'side', 'core');
     123        }
    123124    }
    124125
    125126    public static function render_meta_box($post) {
    126127
    127         if($post->post_status!=='draft') {
    128             printf( esc_html__( 'Not a draft' ));
    129             return;
    130         }
    131128        echo '<input type="hidden" name="taxonomy_noncename" id="taxonomy_noncename" value="' .
    132129             wp_create_nonce( 'taxonomy_lswdrafttype' ) . '" />';
  • lsw-organize-drafts/trunk/readme.txt

    r1339374 r1340949  
    77Requires at least: 4.4.0
    88Tested up to: 4.4.1
    9 Stable tag: 1.0.0
     9Stable tag: 1.0.1
    1010License: GPLv2 or later
    1111License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    5757== Changelog ==
    5858
     59= 1.0.1 =
     60
     61* Fixed issue with meta box appearing on published posts.
     62
    5963= 1.0.0: January 2016 =
    6064
     
    6367== Upgrade Notice ==
    6468
     69= 1.0.1 =
     70
     71* Fixed issue with meta box appearing on published posts.
     72
    6573= 1.0.0: January 2016 =
    6674
Note: See TracChangeset for help on using the changeset viewer.