How to Add a Custom Donation Field
You can add extra donation fields with a little bit of custom code.
This is a code snippet that shows how you can add a field to collect someone’s National ID Number: https://github.com/Charitable/library/blob/master/donation-form/collect-national-id-number.php
You can use that code snippet and customize it to suit your needs:
- Replace every instance of ‘national_id_number’ with ‘your_field’.
- Replace every instance of ‘National ID Number’ with the label for your field.
How to add a code snippet
If you are new to PHP or WordPress development, we recommend adding these code snippets using the Code Snippets plugin. This allows you to add the code directly within your WordPress dashboard.
For those a little more familiar with WordPress development, you can use the snippets to create simple standalone plugins. Read the WordPress documentation about creating a plugin.
Alternatively, you could add the snippets directly to your theme or child theme’s
If you run into any problems with this, please post your code snippet into a Gist at https://gist.github.com so that we can easily help you out.