Register Multiple Donation Fields
/** * If you want to add multiple new fields to your donation form, * you can do that in a single function. * * In the example below, we add three separate fields: * * – a text field…Continue reading
Join 2,000,000+ Professionals who use WPCode to Future-Proof Their Websites!
/** * If you want to add multiple new fields to your donation form, * you can do that in a single function. * * In the example below, we add three separate fields: * * – a text field…Continue reading
/** * Disable the donation receipt email for offline donations. */ add_filter( ‘charitable_send_donation_receipt’, /** * Our callback function. * * @param boolean $send_email Whether to send the email. * @param Charitable_Donation $donation The donation object. * @return boolean Whether to…Continue reading
/** * Add a text field to the donation form. * * This field is added to the donor details section (by default, this is the section * with a header of “Your Details”). In the example below, we add…Continue reading
/** * Send the donation receipt to the site admin as well. * * @param string|string[] $recipients * @return string[] $recipients */ function en_copy_donation_receipt_to_admin( $recipients ) { /** * If it isn’t an array, cast it to one. */ if…Continue reading
/** * This snippet shows how to enable an email tag for the gateway_label * donation field. * * This same pattern can be used to enable email tags for other * donation fields. Find a list of the default…Continue reading
/** * Right after a donation is made, this sends a notification to admin if * the donation is pending AND it was made in offline mode. * * @param int $donation_id * @return boolean */ function en_send_donation_notification_for_pending_offline( $donation_id )…Continue reading
/** * Add a Terms and Conditions donation field, showing * whether the donor accepted terms and conditions when * they donated. */ add_action( ‘init’, function() { /* Create the `Charitable_Donation_Field` object. */ $field = new Charitable_Donation_Field( ‘accept_terms’, array( ‘label’…Continue reading
This snippet has moved to https://github.com/Charitable/library/tree/master/forms/general/remove-form-fields.phpContinue reading
/* * A local translation snippet. Change ‘YOUR TEXT HERE’ to your desired text. * * This snippet will work for any phrases in Charitable and Charitable extensions. */ function charitable_text_switcher( $translations, $text, $domain ) { // Changes the “Donate”…Continue reading
/** * This example shows how to make a form field required or not required. * * Our first example below changes the ‘phone’ field in the Donation Form * into a required field; our second example changes the ‘first_name’…Continue reading