I want to know how Library select multiple images on click Wordpress Media

446 Views Asked by At

Hi guys I'm working with woocommerce and I would like to know how I can do so that when uploading a product and want to add multiple images to the gallery do not have to press ctrl if you can just click.

I have found this here but I do not know where to add that code to make it work.

  if($(this).hasClass('multiple-image-button')) {
        // Set the wp.media attributes
        var send_attachment_multiple = wp.media({
            title : 'Choose or Upload an Image',
            multiple: 'add',

            library: {
                type: [ 'image' ]
            },
        });
    } else {
        //uploadSingleImages(this);
        // Set the wp.media attributes
        var send_attachment_multiple = wp.media({
            title : 'Choose or Upload an Image',
            multiple: false,
            library: {
                type: [ 'image' ]
            },
        });
    }

thank you very much for your help

1

There are 1 best solutions below

0
On

To add multiple image in gallery by wp.media, then

var send_attachment_multiple = wp.media({
        title : 'Choose or Upload an Image',
        multiple: True,
        library: {
            type: [ 'image' ]
        },
    });
}

You have to make the multiple as true for selecting multiple images