custom_fields as $field) { if ($field['type'] == 'integer') { $instance[$field['name']] = intval($new_instance[$field['name']]); } else { $instance[$field['name']] = $new_instance[$field['name']]; } } return $instance; } function form($instance) { $defaults = array(); foreach ($this->custom_fields as $field) { $defaults[$field['name']] = $field['default']; } $instance = wp_parse_args( (array) $instance, $defaults); ?> custom_fields as $field) : ?> front_end($args, $instance); echo $after_widget; } function front_end($args, $instance) { // empty } } /* * Field rendering functions. Called in the admin when showing the widget form. */ function widget_field_text($obj, $instance, $fieldname, $fieldtitle) { $value = $instance[$fieldname]; ?>