$firstname = WP_Form_Element::create('text')->set_name('first-name')->set_label('First Name'); $firstname->set_view(new WP_Form_View_Input()); $firstname->add_decorator('WP_Form_Decorator_Label', array()); $firstname->add_decorator('WP_Form_Decorator_Description', array()); $firstname->add_decorator('WP_Form_Decorator_HtmlTag', array('tag' => 'div', 'attributes' => array( 'class' => 'control-group' ))); $lastname = WP_Form_Element::create('text')->set_name('last-name')->set_label('Last Name'); $lastname->set_view(new WP_Form_View_Input()); $lastname->add_decorator('WP_Form_Decorator_Label', array('position' => WP_Form_Decorator::POSITION_BEFORE)); $lastname->add_decorator('WP_Form_Decorator_Description', array()); $lastname->add_decorator('WP_Form_Decorator_HtmlTag', array('tag' => 'div', 'attributes' => array( 'class' => 'control-group' ))); $submit = WP_Form_Element::create('submit') ->set_name('submit') ->set_label('WP-FORM'); $form->add_element($firstname); $form->add_element($lastname); $form->add_element($submit); $form->add_class('form-example');