public function admin_register_meta_box_attributes() { $meta_box = new MetaBox('attributes', __('Attributes', 'wpk15')); $meta_box->add_field('price', __('Price', 'wpk15'), function () { $field = new Number(); $field->set_min(0.0); return $field; }); $meta_box->add_field('in-stock', __('In Stock', 'wpk15'), 'Checkbox'); $meta_box->add_post_type($this->_post_type_product); }
/** * Attach a meta box that will be used with this post type * * @param MetaBox $meta_box meta box object */ public function add_meta_box(MetaBox $meta_box) { $meta_box->add_post_type($this); }