do_settings_sections()
最后更新于:2021-11-26 03:58:28
do_settings_sections( string$page)Prints out all settings sections added to a particular settings page
参数
- $page
-
(string) (Required) The slug name of the page whose settings sections you want to output.
源文件
文件: gc-admin/includes/template.php
function do_settings_sections( $page ) {
global $gc_settings_sections, $gc_settings_fields;
if ( ! isset( $gc_settings_sections[ $page ] ) ) {
return;
}
foreach ( (array) $gc_settings_sections[ $page ] as $section ) {
if ( $section['title'] ) {
echo "<h2>{$section['title']}</h2>n";
}
if ( $section['callback'] ) {
call_user_func( $section['callback'], $section );
}
if ( ! isset( $gc_settings_fields ) || ! isset( $gc_settings_fields[ $page ] ) || ! isset( $gc_settings_fields[ $page ][ $section['id'] ] ) ) {
continue;
}
echo '<table class="form-table" role="presentation">';
do_settings_fields( $page, $section['id'] );
echo '</table>';
}
}