Adding priority to settings sections.
|Reported by:||alexmansfield||Owned by:|
|Component:||Plugins||Keywords:||has-patch settings-api 3.6-early|
Currently there is no way (at least that I could find) to specify the order of settings sections on a settings page (for example, a theme options page). Use case: a child theme adding a settings section to the parent theme's "Theme Options" page has no way of specifying where on the page the new section should be placed.
I've modified the add_settings_section() function to allow for a priority to be set (much like when adding sections to the theme customizer). I also added uasort($wp_settings_sections[$page], 'compare_priority'); to the do_settings_section() function, where 'compare_priority' is a slightly modified version of the compare function used to set the priority of the theme customizer sections. The patch is based on version 3.4.2, but I'd be happy to make another for the development version if that would help.
This is my first patch submitted, so please let me know if I need to do anything differently. Thanks!
Change History (24)
comment:11 @SergeyBiryukov — 2 years ago
- Keywords has-patch settings-api added; settings-3.6 removed
comment:22 @nacin — 14 months ago
- Component changed from Plugins to Admin APIs
- Focuses administration added