posttype = $posttype; $this->metaboxes_fields = $fields; add_action( 'add_meta_boxes', array( &$this, 'new_metaboxes' ) ); add_action( 'save_post', array( &$this, 'sheeba_lite_metaboxes_save' ) ); } public function new_metaboxes() { $posttype = $this->posttype ; add_meta_box( $posttype, ucfirst($posttype).' settings', array( &$this, 'metaboxes_panel' ), $posttype, 'normal', 'high' ); } public function metaboxes_panel() { $metaboxes_fields = $this->metaboxes_fields ; global $post, $post_id; foreach ($metaboxes_fields as $value) { switch ( $value['type'] ) { case 'navigation': ?>


" />

metaboxes_fields ; foreach ($metaboxes_fields as $fields ) { foreach ($fields as $field) { if ( isset($field['id']) && isset ($_POST[$field['id']] ) ) { switch ( $field['type'] ) { case 'select': $value = $_POST[$field['id']]; $newValue = (array_key_exists($value, $field['options'])) ? $value : $field['std']; update_post_meta($post_id, $field['id'], $newValue ); break; case 'text': $value = $_POST[$field['id']]; $newValue = sanitize_text_field($value); update_post_meta($post_id, $field['id'], $newValue ); break; case 'textarea': $value = $_POST[$field['id']]; $newValue = sanitize_textarea_field($value); update_post_meta($post_id, $field['id'], $newValue ); break; } } } } } } } ?>