diff --git a/src/wp-admin/includes/template.php b/src/wp-admin/includes/template.php
index b367264435..737f02e40f 100644
|
a
|
b
|
function do_accordion_sections( $screen, $context, $data_object ) { |
| 1561 | 1561 | * fields. It can output nothing if you want. |
| 1562 | 1562 | * |
| 1563 | 1563 | * @since 2.7.0 |
| | 1564 | * @since 6.1.0 Added an `$args` parameter for the section's wrapper HTML and class name. |
| 1564 | 1565 | * |
| 1565 | 1566 | * @global array $wp_settings_sections Storage array of all settings sections added to admin pages. |
| 1566 | 1567 | * |
| … |
… |
function do_accordion_sections( $screen, $context, $data_object ) { |
| 1570 | 1571 | * @param string $page The slug-name of the settings page on which to show the section. Built-in pages include |
| 1571 | 1572 | * 'general', 'reading', 'writing', 'discussion', 'media', etc. Create your own using |
| 1572 | 1573 | * add_options_page(); |
| | 1574 | * @param array $args { |
| | 1575 | * Arguments used to create the settings section. |
| | 1576 | * |
| | 1577 | * @type string $before_section HTML content to prepend to the section's HTML output. |
| | 1578 | * Receives the section's class name as `%s`. Default empty. |
| | 1579 | * @type string $after_section HTML content to append to the section's HTML output. Default empty. |
| | 1580 | * @type string $section_class The class name to use for the section. Default empty. |
| | 1581 | * } |
| 1573 | 1582 | */ |
| 1574 | | function add_settings_section( $id, $title, $callback, $page ) { |
| | 1583 | function add_settings_section( $id, $title, $callback, $page, $args = array() ) { |
| 1575 | 1584 | global $wp_settings_sections; |
| 1576 | 1585 | |
| | 1586 | $defaults = array( |
| | 1587 | 'id' => $id, |
| | 1588 | 'title' => $title, |
| | 1589 | 'callback' => $callback, |
| | 1590 | 'before_section' => '', |
| | 1591 | 'after_section' => '', |
| | 1592 | 'section_class' => '', |
| | 1593 | ); |
| | 1594 | |
| | 1595 | $section = wp_parse_args( $args, $defaults ); |
| | 1596 | |
| 1577 | 1597 | if ( 'misc' === $page ) { |
| 1578 | 1598 | _deprecated_argument( |
| 1579 | 1599 | __FUNCTION__, |
| … |
… |
function add_settings_section( $id, $title, $callback, $page ) { |
| 1600 | 1620 | $page = 'reading'; |
| 1601 | 1621 | } |
| 1602 | 1622 | |
| 1603 | | $wp_settings_sections[ $page ][ $id ] = array( |
| 1604 | | 'id' => $id, |
| 1605 | | 'title' => $title, |
| 1606 | | 'callback' => $callback, |
| 1607 | | ); |
| | 1623 | $wp_settings_sections[ $page ][ $id ] = $section; |
| 1608 | 1624 | } |
| 1609 | 1625 | |
| 1610 | 1626 | /** |
| … |
… |
function do_settings_sections( $page ) { |
| 1700 | 1716 | } |
| 1701 | 1717 | |
| 1702 | 1718 | foreach ( (array) $wp_settings_sections[ $page ] as $section ) { |
| | 1719 | if ( '' !== $section['before_section'] ) { |
| | 1720 | echo sprintf( $section['before_section'], $section['section_class'] ); |
| | 1721 | } |
| | 1722 | |
| 1703 | 1723 | if ( $section['title'] ) { |
| 1704 | 1724 | echo "<h2>{$section['title']}</h2>\n"; |
| 1705 | 1725 | } |
| … |
… |
function do_settings_sections( $page ) { |
| 1714 | 1734 | echo '<table class="form-table" role="presentation">'; |
| 1715 | 1735 | do_settings_fields( $page, $section['id'] ); |
| 1716 | 1736 | echo '</table>'; |
| | 1737 | |
| | 1738 | if ( '' !== $section['after_section'] ) { |
| | 1739 | echo $section['after_section']; |
| | 1740 | } |
| 1717 | 1741 | } |
| 1718 | 1742 | } |
| 1719 | 1743 | |