parent = $parent; $this->option_name = $field['option_name']; $this->option_id = parent::beautifyid($field['option_name']); $this->value = $value; $this->field = wp_parse_args( $field, array( 'id' => '', 'title' => '', 'desc' => '', 'default' => '#ffffff', 'readonly' => false, ) ); // If value does not set, use the default if( is_null($this->value) ) { $this->value = $this->field['default']; } parent::__construct($this->field); } /** * Enqueue scripts * * Enqueue scripts and styles that field needed. * This function will be called by it parent class * by default, so you don't need to add action again. * * @since 1.0 * @return void */ public static function admin_enqueue_scripts() { if( is_admin() ) { wp_enqueue_style( 'wp-color-picker' ); } } /** * Render field * * Create the HTML interface for your field * * @param $field - an array holding all the field's data * * @since 1.0 * @return void */ public function render_field() { //input type can also be set as 'color', seems fun. ?> field['desc'] ); ?>