Upload multiple images at once in Classipress
Classipress uses the popular uploader plupload, but for some reason, the theme does not allow the users to select more than one image after clicking on the ‘add image’ button. So users need to ulpload the images one by one. That’s tedious sometimes and not very user friendly, specially when this uploader has the multiple selection feature already built-in. So to enable this feature in a elegant way you can simply use this small code snippet in your childtheme:
add_filter('appthemes_plupload_config', 'enable_plupload_multisel', 10 ,1); function enable_plupload_multisel($app_plupload_config) { $app_plupload_config['plupload']['multi_selection'] = true; return $app_plupload_config; }
Alvaro
03/11/2015 @ 12:17
Hi! where exactly should this code be added? :)
alucas
03/11/2015 @ 12:21
Hi Alvaro
You can add it to your functions.php (if possible in your childtheme functions.php)
Regards
Holger
26/02/2016 @ 15:24
Hi!
Is this still valid for CP 3.5.3?
alucas
26/02/2016 @ 15:27
Not tested yet, but in theory it should work.
Regards
Holger
26/02/2016 @ 15:56
Sorry, does not look like it works. I added it to the bottom of functions.php
/Holger
Holger
01/03/2016 @ 10:41
Do you have an idea?
I added the code nearly the bottom of
/wp-content/themes/classipress/functions.php
// Set the content width based on the theme’s design and stylesheet.
// Used to set the width of images and content. Should be equal to the width the theme
// is designed for, generally via the style.css stylesheet.
if ( ! isset( $content_width ) ) {
$content_width = 500;
}
add_filter(‘appthemes_plupload_config’, ‘enable_plupload_multisel’, 10 ,1);
function enable_plupload_multisel($app_plupload_config)
{
$app_plupload_config[‘plupload’][‘multi_selection’] = true;
return $app_plupload_config;
}
appthemes_init();
alucas
02/03/2016 @ 03:34
Hello Holger
We have not tested it yet with CP 3.5.3, I will get back to you when we have a chance to test it.
Regards
Kara
09/09/2016 @ 16:43
I don’t have a child theme, can i still use this?
alucas
09/09/2016 @ 17:05
Hi Kara
Yes, you can use it. You will need to add the code snippet to your classipress file named functions.php.
Note that when you upgrade your classipress theme,this file will be overwritten, so you will need to add the code again.
Another option would be to create a simple plugin to add this feature
Regards
Moses
04/03/2017 @ 16:56
i just tried it
not working :(
alucas
04/03/2017 @ 18:59
Hi mosses
What is your classipress version?
Alvaro
30/04/2017 @ 13:40
Hi, I added it at the end of the function.php file of the childtheme (Flatron), and the website simple crashed, Error 500 it doesn’t display anything.
I had to enter through the ftp and delete the piece of code to recover it again…
Any idea?
I use Classipress 3.5.7 and WP 4.7
alucas
30/04/2017 @ 14:15
Hi Alvaro
Are you including the first and last lines? I mean, these ones:
If so, this is not PHP code, this is a wordpress tag to show source code in my post. Please copy only the PHP code in your functions.php, so this:
add_filter(‘appthemes_plupload_config’, ‘enable_plupload_multisel’, 10 ,1);
function enable_plupload_multisel($app_plupload_config)
{
$app_plupload_config[‘plupload’][‘multi_selection’] = true;
return $app_plupload_config;
}
alucas
30/04/2017 @ 14:24
Hi Folks
We’ve just updated the post because the wordpress code tags were not working fine and some users were including the wordpress code tags in the functions.php file and this is not php code, is just a shortcode provided by wordpress to nicely show code.
We’re sorry about the inconveniences.
Regards
Alvaro
26/05/2018 @ 19:48
Hi Lucas, I don’t know what I did wrong the last time, but now it works like a charm!!
Thank you!!
danmont7
16/06/2019 @ 02:01
Hi Lucas,
Thank you for the code! It works great!
The only problem is that there is no limit set to the number of images user can upload. I have set the limit to 10 in the classipress settings and I added your code to the theme. However, I can upload more than 10 images. Is there a way to limit the number of images user can upload? Thank you.
alucas
26/06/2019 @ 00:25
Hi Danmont7
I think there is a plupload setting to control this parameter named allowed_files. To be honest, I would need to test it to be 100% sure :)
Regards