Pre-made custom meta fields on donation forms #7190
Unanswered
chamb55
asked this question in
Developer Q&A
Replies: 1 comment
-
Hey @chamb55 Your second method is the recommended way. The file field comes with additional validation methods: However, by default this file field is processed as a WordPress attachment and the meta refers to the attachment ID. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Im trying to create pre-made custom meta fields on donation forms when they are created, without the manual addition of custom fields using Visual Form Builder. Specifically, I aim to include an image upload button. To address this, I've been exploring solutions using the API and the givewp-snippet-library.
I need to add an "image upload button " to the default form programmatically. I tried this two methods.
1. First Method
2. Second Method
The second method, using API, is working. However, I need more information about the "File" method and its related attributes. I need to limit the file size to 1MB and allow file formats with .jpeg, .png, and .gif file extensions. Currently, the meta field value is saved in the database as a meta value, but I need to save it as a file directory path. Is there any way to achieve this?
Referrer links
donor Meta Method : (https://github.com/impress-org/givewp-snippet-library/blob/master/donors/add-donor-meta.php)
second Method : Donor meta using the Fields API: (https://givewp.com/documentation/developers/how-to-create-custom-form-fields/)
Beta Was this translation helpful? Give feedback.
All reactions