Make WordPress Core

Ticket #17851: #17851.patch

File #17851.patch, 1.5 KB (added by rehanali, 4 years ago)

Added patch

  • template.php

     
    15571557 *                           'general', 'reading', 'writing', 'discussion', 'media', etc. Create your own using
    15581558 *                           add_options_page();
    15591559 */
    1560 function add_settings_section( $id, $title, $callback, $page ) {
     1560function add_settings_section($id, $title, $callback, $page, $args = array()) {
    15611561        global $wp_settings_sections;
    15621562
     1563        $defaults = array(
     1564                        'id' => $id,
     1565                        'title' => $title,
     1566                        'callback' => $callback,
     1567                            'before_section' => "",
     1568                            'after_section' => "",
     1569                            'section_class' => "",
     1570                        );
     1571                        $section = wp_parse_args( $args, $defaults );
     1572
    15631573        if ( 'misc' === $page ) {
    15641574                _deprecated_argument(
    15651575                        __FUNCTION__,
     
    16861696        }
    16871697
    16881698        foreach ( (array) $wp_settings_sections[ $page ] as $section ) {
     1699                if ( $section['before_section'] != "" ) {
     1700                         echo sprintf($section['before_section'], $section['section_class']);
     1701                        }
     1702
    16891703                if ( $section['title'] ) {
    16901704                        echo "<h2>{$section['title']}</h2>\n";
    16911705                }
     
    17001714                echo '<table class="form-table" role="presentation">';
    17011715                do_settings_fields( $page, $section['id'] );
    17021716                echo '</table>';
     1717                 if ( $section['after_section'] != "" ) {
     1718                 echo $section['after_section'];
     1719                     }           }
    17031720        }
    17041721}
    17051722