{{label}} {{input}}'; $label_tpl = ''; $input_tpl = '
'; $fields_parameters = array( 'author' => array( 'label' => __( 'Name', 'bootswatch' ), 'type' => 'text', 'value' => esc_attr( $commenter['comment_author'] ), 'required' => $required, 'aria-required' => $aria_required, 'size' => 30, 'maxlength' => 245, ), 'email' => array( 'label' => __( 'Email', 'bootswatch' ), 'type' => 'email', 'value' => esc_attr( $commenter['comment_author_email'] ), 'required' => $required, 'aria-required' => $aria_required, 'size' => 30, 'maxlength' => 100, 'describedby' => 'email-notes', ), 'url' => array( 'label' => __( 'Website', 'bootswatch' ), 'type' => 'url', 'value' => esc_attr( $commenter['comment_author_url'] ), 'size' => 30, 'maxlength' => 200, ), ); foreach ( $fields_parameters as $field => $parameter ) { // Add some defaults to field. $parameter += [ 'id' => $field, 'name' => $field, 'class' => 'form-control', ]; // Build . $input = $input_tpl; foreach ( array( 'name', 'id', 'type', 'value', 'required', 'aria-required', 'size', 'maxlength', 'describedby', 'class' ) as $p ) { if ( ! empty( $parameter[ $p ] ) ) { $input = str_replace( '{{param}}', sprintf( ' %s="%s"{{param}}', $p, $parameter[ $p ] ), $input ); } } $input = str_replace( '{{param}}', '', $input ); // Build