WordPress.org

Ready to get started?Download WordPress

Forums

Adding multiple WP_Customize_Image_Control to 1 section (1 post)

  1. njrwc
    Member
    Posted 1 year ago #

    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?

    Thanks!

    Ron
    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,
    
    			  ) ) );
    	}

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.