wpseek.com
A WordPress-centric search engine for devs and theme authors
do_settings_sections › WordPress Function
Since2.7.0
Deprecatedn/a
› do_settings_sections ( $page )
| Parameters: |
|
| Defined at: |
|
| Codex: |
Prints out all settings sections added to a particular settings page.
Part of the Settings API. Use this in a settings page callback function to output all the sections and fields that were added to that $page with add_settings_section() and add_settings_field()Related Functions: add_settings_section, do_settings_fields, doing_action, settings_errors, add_settings_error
Source
function do_settings_sections( $page ) {
global $wp_settings_sections, $wp_settings_fields;
if ( ! isset( $wp_settings_sections[ $page ] ) ) {
return;
}
foreach ( (array) $wp_settings_sections[ $page ] as $section ) {
if ( '' !== $section['before_section'] ) {
if ( '' !== $section['section_class'] ) {
echo wp_kses_post( sprintf( $section['before_section'], esc_attr( $section['section_class'] ) ) );
} else {
echo wp_kses_post( $section['before_section'] );
}
}
if ( $section['title'] ) {
echo "<h2>{$section['title']}</h2>\n";
}
if ( $section['callback'] ) {
call_user_func( $section['callback'], $section );
}
if ( isset( $wp_settings_fields[ $page ][ $section['id'] ] ) ) {
echo '<table class="form-table" role="presentation">';
do_settings_fields( $page, $section['id'] );
echo '</table>';
}
if ( '' !== $section['after_section'] ) {
echo wp_kses_post( $section['after_section'] );
}
}
}