Ticket #17851: template.php.2.patch
| File template.php.2.patch, 1.7 KB (added by , 9 years ago) |
|---|
-
template.php
1203 1203 * 'general', 'reading', 'writing', 'discussion', 'media', etc. Create your own using 1204 1204 * add_options_page(); 1205 1205 */ 1206 function add_settings_section($id, $title, $callback, $page ) {1206 function add_settings_section($id, $title, $callback, $page, $args = array()) { 1207 1207 global $wp_settings_sections; 1208 1208 1209 $defaults = array( 1210 'id' => $id, 1211 'title' => $title, 1212 'callback' => $callback, 1213 'before_section' => "", 1214 'after_section' => "", 1215 'section_class' => "", 1216 ); 1217 $section = wp_parse_args( $args, $defaults ); 1218 1209 1219 if ( 'misc' == $page ) { 1210 1220 _deprecated_argument( __FUNCTION__, '3.0.0', sprintf( __( 'The "%s" options group has been removed. Use another settings group.' ), 'misc' ) ); 1211 1221 $page = 'general'; … … 1216 1226 $page = 'reading'; 1217 1227 } 1218 1228 1219 $wp_settings_sections[$page][$id] = array('id' => $id, 'title' => $title, 'callback' => $callback);1229 $wp_settings_sections[$page][$id] = $section; 1220 1230 } 1221 1231 1222 1232 /** … … 1290 1300 return; 1291 1301 1292 1302 foreach ( (array) $wp_settings_sections[$page] as $section ) { 1303 if ( $section['before_section'] != "" ) { 1304 echo sprintf($section['before_section'], $section['section_class']); 1305 } 1293 1306 if ( $section['title'] ) 1294 1307 echo "<h2>{$section['title']}</h2>\n"; 1295 1308 … … 1301 1314 echo '<table class="form-table">'; 1302 1315 do_settings_fields( $page, $section['id'] ); 1303 1316 echo '</table>'; 1317 if ( $section['after_section'] != "" ) { 1318 echo $section['after_section']; 1319 } 1304 1320 } 1305 1321 } 1306 1322