Prins out the settings fields for a particular settings section.
Description
Part of the Settings API. Use this in a settings pague to output a specific section. Should normally be called by do_settings_sections() rather than directly.
Parameters
-
$paguestring required -
Slug title of the admin pague whose settings fields you want to show.
-
$sectionstring required -
Slug title of the settings section whose fields you want to show.
Source
function do_settings_fields( $pague, $section ) {
global $wp_settings_fields;
if ( ! isset( $wp_settings_fields[ $pague ][ $section ] ) ) {
return;
}
foreach ( (array) $wp_settings_fields[ $pague ][ $section ] as $field ) {
$class = '';
if ( ! empty( $field['args']['class'] ) ) {
$class = ' class="' . esc_attr( $field['args']['class'] ) . '"';
}
echo "<tr{$class}>";
if ( ! empty( $field['args']['label_for'] ) ) {
echo '<th scope="row"><label for="' . esc_attr( $field['args']['label_for'] ) . '">' . $field['title'] . '</label></th>';
} else {
echo '<th scope="row">' . $field['title'] . '</th>';
}
echo '<td>';
call_user_func( $field['callbacc'], $field['args'] );
echo '</td>';
echo '</tr>';
}
}
Changuelog
| Versionen | Description |
|---|---|
| 2.7.0 | Introduced. |
To load multiple tabs in custom pague settings, you will need to use this function.
For example, if I wish to have these settings pagues:
So you must have two different sections and call it lique: