从foreach循环中的字段创建html表


Create html table from fields in foreach loop

我有以下代码,将自定义字段显示为html表单:

<?php foreach ( $job_fields as $key => $field ) : ?>
        <fieldset class="fieldset-<?php esc_attr_e( $key ); ?>">
            <label for="<?php esc_attr_e( $key ); ?>"><?php echo $field['label'] . apply_filters( 'submit_job_form_required_label', $field['required'] ? '' : ' <small>' . __( '(optional)', 'wp-job-manager' ) . '</small>', $field ); ?></label>
            <div class="field <?php echo $field['required'] ? 'required-field' : ''; ?>">
                <?php get_job_manager_template( 'form-fields/' . $field['type'] . '-field.php', array( 'key' => $key, 'field' => $field ) ); ?>
            </div>
        </fieldset>

有没有办法自定义这个代码,改为在html表中显示字段?

只需将etc.替换为etc。首先创建空白的HTML表,然后将所有的放在适当的位置。