| 1687 | | if ( $section['callback'] ) { |
| 1688 | | call_user_func( $section['callback'], $section ); |
| 1689 | | } |
| | 1686 | /** |
| | 1687 | * Prints out a particular settings section added to a particular settings page |
| | 1688 | * |
| | 1689 | * Part of the Settings API. Use this in a settings page callback function |
| | 1690 | * to output all the fields that were added into the $section_to_find for that $page with |
| | 1691 | * add_settings_section() and add_settings_field() |
| | 1692 | * |
| | 1693 | * @global array $wp_settings_sections Storage array of all settings sections added to admin pages. |
| | 1694 | * |
| | 1695 | * @param string $page The slug name of the page whose settings sections you want to output. |
| | 1696 | * @param string $section_to_find The id of the section on $page you want to output. |
| | 1697 | */ |
| | 1698 | function do_settings_section( $page, $section_to_find ) { |
| | 1699 | global $wp_settings_sections; |
| | 1721 | * Prints out a particular settings section added to a particular settings page |
| | 1722 | * |
| | 1723 | * Used by do_settings_sections() and do_settings_section() but not intended for public use |
| | 1724 | * |
| | 1725 | * @global array $wp_settings_fields Storage array of settings fields and info about their pages/sections. |
| | 1726 | * |
| | 1727 | * @param string $page The slug name of the page whose settings sections you want to output. |
| | 1728 | * @param array $section The section array from $wp_settings_sections to be output. |
| | 1729 | */ |
| | 1730 | function render_settings_section( $page, $section ) { |
| | 1731 | global $wp_settings_fields; |
| | 1732 | |
| | 1733 | if ( ! is_array( $section ) || ! isset( $section['id'] ) ) { |
| | 1734 | return; |
| | 1735 | } |
| | 1736 | |
| | 1737 | if ( $section['title'] ) { |
| | 1738 | echo "<h2>{$section['title']}</h2>\n"; |
| | 1739 | } |
| | 1740 | |
| | 1741 | if ( $section['callback'] ) { |
| | 1742 | call_user_func( $section['callback'], $section ); |
| | 1743 | } |
| | 1744 | |
| | 1745 | if ( ! isset( $wp_settings_fields ) || ! isset( $wp_settings_fields[ $page ] ) || ! isset( $wp_settings_fields[ $page ][ $section['id'] ] ) ) { |
| | 1746 | return; |
| | 1747 | } |
| | 1748 | echo '<table class="form-table" role="presentation">'; |
| | 1749 | do_settings_fields( $page, $section['id'] ); |
| | 1750 | echo '</table>'; |
| | 1751 | } |
| | 1752 | |
| | 1753 | /** |