/** * set class instance * @param $inst: an object instanceof this class */ public static function setInstance($inst) { if ($inst instanceof HW_Conditions_Metabox) { self::$instance = $inst; } }
/** * init metaboxs */ public static function init_metabox() { if (is_admin()) { global $current_user; if (class_exists('HW_Conditions_Manager') && class_exists('HW_Conditions_Metabox') && current_user_can('administrator')) { new HW_Conditions_Manager(HW_Conditions_Manager::post_type); // the post type slug HW_Conditions_Metabox::setInstance(new HW_Conditions_Metabox(null, __('Thêm điều kiện'), array(HW_Conditions_Manager::post_type), 'normal', 'low')); //add new metabox new HW_Conditions_Metabox(null, __('Hướng dẫn'), array(HW_Conditions_Manager::post_type), 'normal', 'low'); } } }