Support » Plugins and Hacks » Hacks » Adding multiple WP_Customize_Image_Control to 1 section

  • We are working on using the customize feature in WordPress (‘customize.php’)…and have created a section where we would like the user to be able to upload several images.

    The section gets created fine, but it seems that the WP_Customize_Image_Control only works if there is only 1 WP_Customize_Image_Control per section….is this correct?

    Is there a work around for this?


    Here’s some sample code:

    $wp_customize->add_section( 'dh_heading_slides', array(
        'title'          => __('Slideshow', 'dh' ),
    	'description'    => "",
        'priority'       => 35,
    	) );
    	//Add the heading slides
    	for ($i=1; $i<3; $i++)
    		$wp_customize->add_setting('heading_slide_'.$i, array(
    			'default'        => '',
    			'type'           => 'theme_mod',
    			'priority'       => $i,
    		) );
    		//Add the control for uploading the image
    		$wp_customize->add_control( new WP_Customize_Image_Control( $wp_customize,  'heading_slide_'+$i, array(
    				  'label'        => 'Slide #'.$i,
    				  'section'    => "dh_heading_slides",
    				  'settings'   =>'heading_slide_'.$i,
    	  			  'priority'       => $i,
    			  ) ) );

  • The topic ‘Adding multiple WP_Customize_Image_Control to 1 section’ is closed to new replies.