wpseek.com
WordPress开发者和主题制作者的搜索引擎
do_settings_fields › WordPress Function
Since2.7.0
已弃用n/a
› do_settings_fields ( $page, $section )
| 参数: (2) |
|
| 定义在: |
|
| 文档: |
Prints out the settings fields for a particular settings section.
Part of the Settings API. Use this in a settings page to output a specific section. Should normally be called by do_settings_sections() rather than directly.Related Functions: settings_fields, add_settings_field, do_settings_sections, add_settings_error, settings_errors
源码
function do_settings_fields( $page, $section ) {
global $wp_settings_fields;
if ( ! isset( $wp_settings_fields[ $page ][ $section ] ) ) {
return;
}
foreach ( (array) $wp_settings_fields[ $page ][ $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['callback'], $field['args'] );
echo '</td>';
echo '</tr>';
}
}