diff --git a/wp-admin/includes/template.php b/wp-admin/includes/template.php index 3661d582a..c599cd76c 100644 --- a/wp-admin/includes/template.php +++ b/wp-admin/includes/template.php @@ -1507,7 +1507,6 @@ function add_meta_box($id, $title, $callback, $page, $context = 'advanced', $pri $wp_meta_boxes[$page][$context][$priority][$id] = array('id' => $id, 'title' => $title, 'callback' => $callback); } -// crazyhorse - this can be made simpler function do_meta_boxes($page, $context, $object) { global $wp_meta_boxes; static $already_sorted = false; @@ -1602,4 +1601,89 @@ function meta_box_prefs($page) { } } } + +/** + * Add a new section to a settings page + * + * @since 2.7 + * + * @param string $id String for use in the 'id' attribute of tags. + * @param string $title Title of the section + * @param string $callback Function that fills the section with the desired content. The function should echo its output. + * @param string $page The type of settings page on which to show the section (general, reading, writing, ...) + */ +function add_settings_section($id, $title, $callback, $page) { + global $wp_settings_sections; + + if ( !isset($wp_settings_sections) ) + $wp_settings_sections = array(); + if ( !isset($wp_settings_sections[$page]) ) + $wp_settings_sections[$page] = array(); + if ( !isset($wp_settings_sections[$page][$id]) ) + $wp_settings_sections[$page][$id] = array(); + + $wp_settings_sections[$page][$id] = array('id' => $id, 'title' => $title, 'callback' => $callback); +} + +/** + * Add a new field to a settings page + * + * @since 2.7 + * + * @param string $id String for use in the 'id' attribute of tags. + * @param string $title Title of the field + * @param string $callback Function that fills the field with the desired content. The function should echo its output. + * @param string $page The type of settings page on which to show the field (general, reading, writing, ...) + * @param string $section The section of the settingss page in which to show the box (default, ...) + * @param array $args Additional arguments + */ +function add_settings_field($id, $title, $callback, $page, $section = 'default', $args = array()) { + global $wp_settings_fields; + + if ( !isset($wp_settings_fields) ) + $wp_settings_fields = array(); + if ( !isset($wp_settings_fields[$page]) ) + $wp_settings_fields[$page] = array(); + if ( !isset($wp_settings_fields[$page][$section]) ) + $wp_settings_fields[$page][$section] = array(); + + $wp_settings_fields[$page][$section][$id] = array('id' => $id, 'title' => $title, 'callback' => $callback, 'args' => $args); +} + +function do_settings_sections($page) { + global $wp_settings_sections, $wp_settings_fields; + + if ( !isset($wp_settings_sections) || !isset($wp_settings_sections[$page]) ) + return; + + foreach ( (array) $wp_settings_sections[$page] as $section ) { + echo "
diff --git a/wp-admin/options-general.php b/wp-admin/options-general.php index aac087e86..fbf945269 100644 --- a/wp-admin/options-general.php +++ b/wp-admin/options-general.php @@ -117,8 +117,11 @@ endfor; ?> + + +
diff --git a/wp-admin/options-misc.php b/wp-admin/options-misc.php index fc98fa64f..3023dde65 100644 --- a/wp-admin/options-misc.php +++ b/wp-admin/options-misc.php @@ -45,6 +45,7 @@ include('admin-header.php'); + @@ -130,7 +131,7 @@ include('admin-header.php'); ?> - + @@ -157,6 +158,8 @@ include('admin-header.php'); + +
diff --git a/wp-admin/options-permalink.php b/wp-admin/options-permalink.php index 689c83a6d..e0f2b345d 100644 --- a/wp-admin/options-permalink.php +++ b/wp-admin/options-permalink.php @@ -191,7 +191,11 @@ $structures = array(
diff --git a/wp-admin/options-reading.php b/wp-admin/options-reading.php index 8cedc7635..af2bf1634 100644 --- a/wp-admin/options-reading.php +++ b/wp-admin/options-reading.php @@ -72,6 +72,7 @@ include('admin-header.php');
diff --git a/wp-admin/options-writing.php b/wp-admin/options-writing.php index 0d7d6b2c3..71ac9c56d 100644 --- a/wp-admin/options-writing.php +++ b/wp-admin/options-writing.php @@ -63,6 +63,7 @@ endforeach; ?> +
@@ -83,7 +84,9 @@ endforeach; />%s, %s
, %s
.'), wp_generate_password(8, false), wp_generate_password(8, false), wp_generate_password(8, false)) ?>