Add Custom Campaign Field

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

Remove Donation Form Fields

/** * This example shows how to remove fields from the donation form. * * Note that this approach requires Charitable 1.6 or above. */ add_action( ‘init’, function() { $fields_api = charitable()->donation_fields(); /** * In this example, we remove the…Continue reading

Change Postcode To Zipcode

/** * Change the “Postcode” field into a “ZIP Code” field. * * @param array[] $fields * @return array[] */ add_action( ‘init’, function ( $fields ) { $fields = charitable()->donation_fields(); $field = $fields->get_field( ‘postcode’ ); $field->label = ‘ZIP Code’; $field->set(…Continue reading

Add Campaign Title To Start

/** * This snippet shows you how you can easily add the campaign name * as a heading before the donation form. * * @param Charitable_Form $form * @return void */ function ed_show_campaign_title_before_donation_before( $form ) { if ( ! is_a(…Continue reading

Add Picture Field To Donation Form

/** * In this example, a picture field is added to the donation form, * allowing donors to upload an image as part of the donation process. * * The picture ID is added in the donation meta, with a…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