Remove Section
/** * You may decide that you do not need some of the sections in the Profile form at all. * This code will allow you to remove an entire section. * * If you just want to remove individual…Continue reading
Join 2,000,000+ Professionals who use WPCode to Future-Proof Their Websites!
/** * You may decide that you do not need some of the sections in the Profile form at all. * This code will allow you to remove an entire section. * * If you just want to remove individual…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
/** * Page caching causes problems for donors who are not logged in. * * This filter disables the nonce check for non-logged in donors. Since this * is provides less protection than the normal nonce check, it is not…Continue reading
/** * This example shows how to add a new donation field to your site, but * only display it in the front-end donation form for a particular campaign. * * Related examples: * * @see Register a text field…Continue reading
/** * 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
/** * 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
/** * 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
/** * 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 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