I have now reached a point, where i have decided to make a jQuery solution to the Multiple image upload, if i dont get a useful answer from the dev.team.
I know you have alot to do, but please keep in mind that i have asked for the multiple image feature for over a year, with promises that it is going to be implemented (by that time Types v.1.4 would have the new multiple image uploader) but still nothing. Im not expecting this over night, i just think that it has taking some time by now, and i still got no really useful answer.
In case of no useful answer, wher i have to develop a js/jquery solution myself, i need to ask: What is the name of the js/ajax function that creates a new field when "Add new image" button is clicked? I need it for my custom solution.
Thanks for you assistance, looking forward to hear from you 🙂
Thanks for the feedback, and let me apologize if our delay has caused you any issue.
You are right: we have been bussy over here. We already have a ticket about this feature, and it is on a status of "pending", as other urgent things happened around. We needed to add support for termmeta fields, for example, as WordPress added it and we needed to cover lots of users needs.
I am adding your voice to that ticket, so our devs know that this is a demanded feature and can find a spot for it, although I can not say whether this will happen soon, to be honest.
About your question, we do not have a public API for managing field repetitions, besides a JavaScript anonymous calñback that generates the right HTML template and appends it to the field group. You might want to simlate a click on that button, but there is no other custom event fired when the new field container is created, so it might not be of much help to you either.
Okay thanks.
I will similate the new image button click, but is there any php method for me to load the javascript only if a post type has custom fields (and a specific type if possible)?
Types already checks whether the current page contains a given field type before enqueuing the assets (mainly, script files) that belong to that field type. IN fact, instead of checking, the code that enqueues the related assets belongs to each field insatnce, so if a field type is not inited, the assets are not loaded.
Related to that, I can tell you that the priority of the task we have about adding multiple files at once on repeating field files has been raised. It is not a promise of this happening now, but it is worth mentioning.
Yes i know Types already checks for a given field type before it enqueues assets (most high-end plugins should do that). This is why im asking if there is any way to do this in a custom plugin as well.
I have created a temporary plugin for uploading Multiple Images. hidden link
Its public in GitHub, and everyone is welcome to contribute to making it better.
Known issues: If having multiple, Multi-image upload fields, it might open the Media Modal multiple times (Needs a fix).
DISCLAIMER: Use on own risk (nothing to worry about, just saying).
As far as I know, Types assets (mainly, scripts and styles) are registered, not just enqueued, only when needed also. Because of that, enqueuing them from outside of Toolset is not posible without some nasty workarounds.
Anyway, as i stated, this is already in our list and its priority was raised.
I am sorry I do not have any better answer as of now.
Hi Juan.
No worries, i understand that there are more people who needs support 🙂
Im not sure you understood what i ment, maybe i didnt explain it good enough. If there is no solution for it also, it doesnt matter, since its only a small jQuery file that gets loaded on each "Edit post" screen.
The plugin i wrote for fixing the multi-image uploader temporary, is a WordPress plugin made with jQuery. What i was trying to do is to detect if a multiple image field is loaded, before loading my plugin jQuery script, so it didnt have to load unnecessary if there is no multiple image field.. I did that now by checking (with jQuery) if a class exists before loading rest of the script, so it should be okay like this.
Your answer for now is okay, im just glad that it finally got the attention it needs, as i (among others) consider this a important update.
Thanks for your assistance Juan 🙂
This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.