Move Fields

/** * Move fields in the Donation Form. * * In the example below, we move the email field to show at priority 3 (before the first name) * and the phone field to show at priority 9 (before the…Continue reading

Change Section Headers

/** * Change the section headers in the donation form. * * @param array $fields All the donation form fields. * @return array */ function ed_charitable_change_donation_form_section_headers( $fields ) { // “Your Donation” $fields[‘donation_fields’][‘legend’] = ‘Choose Your Donation Amount’; // “Details”…Continue reading

Multi Step Donation Form

/** * This snippet provides a foundation for converting the donation form * into a multi-step donation form. */ add_action( ‘charitable_donation_form_before’, function() { ?>Continue reading

Add Field Placeholders

/** * Add placeholder attributes to donation fields, removing the label field. * * @return void */ add_action( ‘init’, function() { $fields = charitable()->donation_fields(); foreach ( $fields->get_donation_form_fields() as $field ) { $label = $field->donation_form[‘label’]; if ( isset( $field->donation_form[‘required’] ) &&…Continue reading

Set State Field To Us States Dropdown With Default

/** * Change the “State” field into a “Province” field. * * @param array[] $fields * @return array[] */ add_action( ‘init’, function ( $fields ) { $fields = charitable()->donation_fields(); $field = $fields->get_field( ‘state’ ); // Change it to a select/drop-down…Continue reading

Remove Login Form

/** * Remove the login prompt from being displayed before the donation form. */ function ed_remove_login_form_before_donation_form() { remove_action( ‘charitable_donation_form_before’, ‘charitable_template_donation_form_login’, 4 ); } add_action( ‘after_setup_theme’, ‘ed_remove_login_form_before_donation_form’, 20 );Continue reading

Add Donation Receipt Opt Out Checkbox

/** * In this function we register a new donation field with a * key of `receipt_opt_out`. If the donor checks this, it means * they don’t want to receive their donation receipt. */ add_action( ‘init’, function() { $field =…Continue reading

Change Accepted Countries Per Campaign

/** * This example shows how to change the accepted countries list on a per-campaign basis. * * @param array $fields The fields in the form. * @return array */ function ed_set_list_of_accepted_countries_by_campaign( $fields, $form ) { /* If a country…Continue reading