Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I have an extended image control for the theme customizer that adds in an extra panel and lists images I have hardcoded into the extended control.

Now the issue is that it is not showing up in the theme customizer. I am not receiving any errors, it just isn't showing up. I think the classes and functions are done right, and I am adding the control to the customizer properly so I am out of ideas as to what the issue is.

Could someone take a look and see if they can spot my issue? I have tried extending both the Customize_Background_Image_Control and the Customize_Image_Control with the same results.

function WP_Customize_Background_Image_Control_Defaults($wp_customize) {

 /* Substitute the default control for our new one */
    $wp_customize->remove_control( 'background_image' );
    $wp_customize->add_control( new WP_Customize_Background_Image_Control_Defaults( $wp_customize ) );

}
    add_action( 'customize_register', 'wp_customize_background_image_control_defaults', 11, 1 );    

   class WP_Customize_Background_Image_Control_Defaults extends WP_Customize_Background_Image_Control {
    public function __construct( $manager ) {

        $this->add_tab( 'builtins', __('Built-ins'), array( $this, 'tab_builtins' ) );

    }
    public function tab_builtins() {

    $backgrounds = array(

            '/wp-content/themes/newtheme/img/backgrounds/background1.jpg', '/wp-content/themes/newtheme/img/backgrounds/background2.jpg', '/wp-content/themes/newtheme/img/backgrounds/background3.jpg', '/wp-content/themes/newtheme/img/backgrounds/background4.jpg', '/wp-content/themes/newtheme/img/backgrounds/background5.jpg'

        );

          if ( empty( $backgrounds ) )
                            return;

                    foreach ( (array) $backgrounds as $background )
                        $this->print_tab_image( esc_url_raw( $background->guid ) );

    }

  }

Here is the code I am using to add the control to the customizer:

    $wp_customize->add_control( new WP_Customize_Background_Image_Control_Defaults( $wp_customize, 'newtheme_above_footer_background', array(

    'label'      => __( 'Background Image', 'newtheme' ),

    'section'    => 'newtheme_above_footer',

    'settings'   => 'newtheme_above_footer_background',

    'priority'   => 30

) ) );  
share|improve this question
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.