Hi,
In a form, I would like to change the 'add new' label to a multiple image field (see capture). I can not find where can I change that ?
thanks.
Olivier
Hi Olivier,
Thank you for contacting us and I'd be happy to assist.
To make the image field in the form, allow multiple image uploads, please go to that image field's settings ( WP Admin -> Toolset -> Custom Fields ), and select the option "Allow multiple-instances of this field".
( ref: https://toolset.com/documentation/user-guides/using-custom-fields/#how-to-add-custom-fields-to-content )
Example screenshot: hidden link
I hope this helps and please let me know if you need any further assistance around this.
regards,
Waqar
Hi Waqar,
I already have a multiple field, I just want to change the label 'add new' which is displayed by default by another label.
Thanks,
Olivier
Hi Olivier,
Thanks for writing back and for clearing this up.
To customize the default label text for the add new link, you can use "toolset_button_add_repetition_text" filter:
function toolset_button_add_repetition_text_callback( $string, $arg1 ) {
$string = "Add more image";
return $string;
}
add_filter( 'toolset_button_add_repetition_text', 'toolset_button_add_repetition_text_callback', 9999, 3 );
The above code can be included in the active theme's "functions.php" file and you can replace "Add more image" text as needed.
I hope this helps and please let me know how it goes.
Note: In case this doesn't work, please share the link to a page where this form can be seen.
regards,
Waqar
Hi Waqar,
how i do when I have multiple types of repetable fields? I should have several different labels: 'add a file' 'add an image'. etc.
Thanks
Olivier
Hi Olivier,
If you'd like to show different labels, for image and file type fields, you can include additional conditions to the custom function like this:
function toolset_button_add_repetition_text_callback( $string, $arg1 ) {
// if image type field
if($arg1['type'] == 'credimage') {
$string = "Add more image";
}
// if file type field
if($arg1['type'] == 'credfile') {
$string = "Add more file";
}
return $string;
}
add_filter( 'toolset_button_add_repetition_text', 'toolset_button_add_repetition_text_callback', 9999, 3 );
I hope this helps and for more personalized assistance around custom code, you can consider hiring a professional from our list of recommended contractors:
https://toolset.com/contractors/
regards,
Waqar
My issue is resolved now. Thank you!