How to Add New Field

FAQ

How to Add New Field

You can create your own option fields. it is easy. you can use override method or directly modification method. let’s take a look examples.

.
├── wpsf-framework
|   ├── fields
|   |   ├── password
|   |   |   ├── password.php
if ( ! defined( 'ABSPATH' ) ) { die; } // Cannot access pages directly.
/**
 *
 * Field: Password
 *
 * @since 1.0
 * @version 1.0
 *
 */
class WPSFFramework_Option_password extends WPSFFramework_Options {

  public function __construct( $field, $value = '', $unique = '' ) {
    parent::__construct( $field, $value, $unique );
  }

  public function output(){

    echo $this->element_before();
    echo '<input type="password" name="'. $this->element_name() .'" value="'. $this->element_value() .'"'. $this->element_class() . $this->element_attributes() .'/>';
    echo $this->element_after();

  }

}
array(
  'id'    => 'unique_option_1',
  'type'  => 'password',
  'title' => 'Password Field',
),

Last updated