Set a maximum limit of files uploaded to a list

hi I tried to load this file in function.php also with the Code Snippets plugin in both cases it gives me fatal error:

<?php
add_filter (
'hivepress / v1 / models / listing',
function ($ model) {
$ template ['fields'] ['images'] ['max_files'] = 123;

returns $ pattern;
},
100
);

With the plugin <? Php was not transcribed as it is already set. Thanks for your help, I have to bring to 20 the maximum number of images to insert as these are real estate ads

Please try this PHP snippet and please just change 123 on the number of your maximum images Change the maximum number of images per listing #hivepress #listings · GitHub

1 Like

yevhen, i already tried, the result was fatal error. thanks for your help.
probably it is the path of the wrong file, can you tell me the exact folder and path?

Please try using the Code Snippets plugin for this purpose, editing specific files is not required. Make sure that you copied the code snippet exactly Change the maximum number of images per listing #hivepress #listings · GitHub Also remove the first line <?php from the snippet because the Code Snippets plugin already adds it to every snippet.

1 Like

ho già provato, il risultato è stato un errore fatale. Grazie per l’aiuto.
probabilmente è il percorso del file sbagliato, puoi dirmi la cartella e il percorso esatti?
I have ftp access and I urgently need to change this parameter, for real estate agencies. I just change the number in the command line, but I couldn’t find it. can you help me?

I have tried again for 3 times now it works, “sorry” how can I translate (Only up to 20 files can be uploaded.)? I tried with loco traslate but it says that it is not verified with my version of wordpress in fact it does not find the words. (wordpress.org). can you help me?

Please try to just copy this code snippet and please change only 123 on the number of your maximum images

add_filter(
	'hivepress/v1/models/listing',
	function( $model ) {
		$model['fields']['images']['max_files'] = 123;

		return $model;
	},
	1000
);

this was not the request yevhen, you can see above that for this I solved. thank you, i was wondering how to change the translation from English to Italian, I didn’t succeed with Loco Tr …

Please make sure that you followed the same steps How to translate HivePress - HivePress Help Center The added language should match the current WordPress dashboard language, then Loco will replace any texts you translate automatically.

1 Like

Ok I found almost everything the only sentence I can’t find is this: Only up to 20 files can be uploaded.

It seems to be available Screenshot by Lightshot If it’s not please click the Sync button in the translation editor to sync the translation file, you can also click Edit Template in Loco/Plugins/HivePress and click the Scan button to refresh the translation template.

I found it but it can’t be translated

If you followed 100% the same steps as show on the screencast from the docs, please send temporary WP access to support@hivepress.io and I’ll check this issue for you.

How to limit uploaded attachment files. For-example when user upload .pdf file how to limit uploading pdf document files to maximum 3 files.

If it’s a custom Attachment attribute, currently, it doesn’t support multiple files per attribute, but it’s possible for images. You can use this code snippet to change the default limit of 10 images per listing Change the maximum number of images per listing #hivepress #listings · GitHub

1 Like