Keep Username As Display Name

/** * When people update their profile, keep their display name set to * be the same as their login name (username). */ function ed_charitable_keep_original_display_name( $values ) { $values[‘display_name’] = wp_get_current_user()->user_login; return $values; } add_filter( ‘charitable_profile_update_values’, ‘ed_charitable_keep_original_display_name’ ); add_filter( ‘charitable_campaign_submission_user_data’,…Continue reading

Change Custom Amount Field Label Per Campaign

/** * Filter the custom amount field description on a per campaign basis. * * @param string $label The default label. * @return string */ function ed_charitable_donation_form_set_custom_amount_field_text_per_campaign( $label ) { $campaign_id = charitable_get_current_campaign_id(); if ( 226 === $campaign_id ) {…Continue reading

Customize Amount Raised Text

/** * In this example, we change how the “X donated of Y goal” text appears. * * @param string $summary The summary. * @param Charitable_Campaign $campaign This campaign object. * @param float $amount The amount donated. * @param int…Continue reading

Move User Fields In Donation Form

/** * In this example we move the user fields section (the “Your Details” bit) to * appear below the payment fields. */ function ed_charitable_move_user_fields_in_donation_form( $fields ) { if ( ! array_key_exists( ‘details_fields’, $fields ) ) { $fields[‘user_fields’][‘priority’] = 80;…Continue reading

Add Read More Link

/** * Add a Read More link to the campaigns in the campaign grid. * * Note: This is designed to be used for cases where you want a Read More link * as well as a Donate button. If…Continue reading

Remove Terms Fields

/** * If you would like to enable the terms and conditions, privacy * policy and user contact consent fields in the registration form * but NOT the donation form, you can add the following bit of code. */ add_filter(…Continue reading

Add Custom Field

/** * Display the custom field. * * @param Charitable_Campaign $campaign * @return void */ function ed_charitable_add_custom_field_to_campaign_grid( $campaign ) { echo $campaign->get( ‘my_custom_field’ ); } /** * You can adjust where the custom field is inserted by changing the priority,…Continue reading

Set Fixed Donation Amount

/** * Automatically set the donation amount and recurring * period for donations. * * @param array $fields * @return array */ function ed_charitable_set_donation_amount( $fields ) { unset( $fields[‘donation_fields’] ); // The amount you would like to donate. $amount =…Continue reading

Remove Campaign Description

/** * Remove the campaign descriptions from the campaign loop. */ function en_remove_campaign_description_in_loop() { remove_action( ‘charitable_campaign_content_loop_after’, ‘charitable_template_campaign_description’, 4 ); } add_action( ‘after_setup_theme’, ‘en_remove_campaign_description_in_loop’, 11 );Continue reading

Set Default Donation Amount Per Campaign

/** * Customize the default donation amount on a per campaign basis. * * @see https://github.com/Charitable/library/blob/master/donation-form/set-default-donation-amount.php * * @param float|int $amount The amount to be filtered. $0 by default. * @param Charitable_Campaign $campaign The instance of `Charitable_Campaign`. * @return float|int…Continue reading