I have an existing Customizer admin page with several controls already added to it by my theme (screenshot). I want to add my own control and insert it somewhere in the middle of my theme's controls. I have added the control to the page with the below code--added to my child theme's functions.php file. But I can only get the control to display before my theme's controls or after my theme's controls (screenshots). How can I ensure the control displays in the middle of my theme's controls?

My Code:

function themename_customize_register($wp_customize){
        $wp_customize->add_setting('test_setting', array(
            'capability'     => 'edit_theme_options',
            'type'           => 'theme_mod',
        $wp_customize->add_control('test_control', array(
            'label'     =>  __('Text Test', 'themename'),
            'section'   =>  'spacious_slider_number_section1',
            'settings'  =>  'test_setting',
            'type'      =>  'checkbox',
            'priority'  =>  '10',
add_action('customize_register', 'themename_customize_register');

If I leave the the 'priority' parameter of $args unset (or set to 10--its default), my new control appears before all my theme's controls. If I set 'priority' to 11 or higher, my new control appears after all my theme's controls.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.