Change Country Field To Hidden

/** * This code snipet shows how to change the Country field in the * donation form to a hidden field with a hard-coded default value. * * This shows in general how you can modify a donation field *…Continue reading

Set Default Donation Amount

/** * Set the default donation amount for all campaigns. * * @see https://github.com/Charitable/library/blob/master/donation-form/set-default-donation-amount-per-campaign.php * * @param float|int $amount The amount to be filtered. $0 by default. * @return float|int */ function ed_charitable_set_default_donation_amount( $amount ) { // Return a default…Continue reading

Display Donation Form

/** * Display a specific campaign’s donation form. * * To integrate this snippet, you will need to insert it * into a custom template in your theme. */ /* Replace 123 with the ID of the campaign. */ $campaign_id…Continue reading

Add Email Headers

/** * Add CC/BCC headers to Charitable emails. * * @param string $headers The default email headers. * @param Charitable_Email $email The email object. * @return string */ function ed_charitable_add_email_headers( $headers, $email ) { /** * If you would only…Continue reading

Add Checkbox Field To Donation Form

/** * Collect a checkbox field in the donation form. * * This snippet only works in Charitable 1.5 or above. * * Related examples: * * @see Register a text field (detailed example) – https://github.com/Charitable/library/blob/master/donation-form/register-new-donation-field-1.5.php * @see Register multiple…Continue reading

Add Custom Donation Field

/** * This example shows how you can add a new donation field to be displayed * in Charitable emails related to donations. */ /** * Register the extra field. * * @param array $fields * @param Charitable_Email $email *…Continue reading

Add Dynamic Hidden Field

/** * In this example, a new donation field is created but left out of the * front-end donation form. Instead, it is dynamically set as a hidden * field in the donation form, based on the ID of the…Continue reading

Disable Donation Receipt For Offline Donations

/** * 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