I’m working on the WordPress Customizer in my theme.
Now suppose i want to create a kind of item with 3 options (in this case, an image and 2 inputs), and i want to let the user to create many of these. I know how to create the text inputs:

$wp_customizer->add_setting('fantastic-input', array(
    'type' => 'theme_mod',
    'default' => 'Make something fantastic!'
));

$wp_customizer->add_control('fantastic-input-opt', array(
    'type' => 'input',
    'section' => 'fantastic-section',
    'settings' => 'fantastic-input',
    'label' => _('Input something fantastic here'),
    'description' => 'This input is fantastic!'
));

and to add an Image selector:

$wp_customizer->add_setting('fantastic-image', array(
    'type' => 'theme_mod',
    'default' => ''
));

$wp_customizer->add_control(new WP_Customize_Image_Control (
    $wp_customizer,
    'fantastic-image',
    array(
        'label' => _('Best image ever'),
        'section' => 'fantastic-section',
    )
));

But what if i don’t want this to be the only one of its kind? Thank you.

Read more here: Create something that can be added or removed in Customizer


Solution:

If you know the solution of this issue, please leave us a reply in Comment section, to update the question.


Wordpress related questions and answers: