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
Join 2,000,000+ Professionals who use WPCode to Future-Proof Their Websites!
/** * 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 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
/** * 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
/** * 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() { if ( ! function_exists( ‘charitable’ ) ) { return; } $fields_api…Continue reading
/** * 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
/** * 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
/** * 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 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
/** * 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
/** * 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