Ticket #17851: template.php.patch
| File template.php.patch, 2.2 KB (added by , 10 years ago) |
|---|
-
template.php
1190 1190 * @param string $title Formatted title of the section. Shown as the heading for the section. 1191 1191 * @param string $callback Function that echos out any content at the top of the section (between heading and fields). 1192 1192 * @param string $page The slug-name of the settings page on which to show the section. Built-in pages include 'general', 'reading', 'writing', 'discussion', 'media', etc. Create your own using add_options_page(); 1193 * @param array $args An array of 3 arguments ('before_section', 'after_section', 'section_class') that allows for adding content and a custom class around the new settings section. 1193 1194 */ 1194 function add_settings_section($id, $title, $callback, $page ) {1195 function add_settings_section($id, $title, $callback, $page, $args = array()) { 1195 1196 global $wp_settings_sections; 1196 1197 1198 $defaults = array( 1199 'id' => $id, 1200 'title' => $title, 1201 'callback' => $callback, 1202 'before_section' => "", 1203 'after_section' => "", 1204 'section_class' => "", 1205 ); 1206 1207 $section = wp_parse_args( $args, $defaults ); 1208 1197 1209 if ( 'misc' == $page ) { 1198 1210 _deprecated_argument( __FUNCTION__, '3.0', sprintf( __( 'The "%s" options group has been removed. Use another settings group.' ), 'misc' ) ); 1199 1211 $page = 'general'; … … 1204 1216 $page = 'reading'; 1205 1217 } 1206 1218 1207 $wp_settings_sections[$page][$id] = array('id' => $id, 'title' => $title, 'callback' => $callback); 1219 // $wp_settings_sections[$page][$id] = array('id' => $id, 'title' => $title, 'callback' => $callback); 1220 $wp_settings_sections[$page][$id] = $section; 1208 1221 } 1209 1222 1210 1223 /** … … 1278 1291 return; 1279 1292 1280 1293 foreach ( (array) $wp_settings_sections[$page] as $section ) { 1294 if ( $section['before_section'] != "" ) { 1295 echo sprintf($section['before_section'], $section['section_class']); 1296 } 1281 1297 if ( $section['title'] ) 1282 1298 echo "<h2>{$section['title']}</h2>\n"; 1283 1299 … … 1289 1305 echo '<table class="form-table">'; 1290 1306 do_settings_fields( $page, $section['id'] ); 1291 1307 echo '</table>'; 1308 1309 if ( $section['after_section'] != "" ) { 1310 echo $section['after_section']; 1311 } 1292 1312 } 1293 1313 } 1294 1314