Add Campaign Raised Summary

/** * Add a short summary after the donation details showing the funds raised by each campaign. */ function ed_add_campaign_stats_to_receipt( $donation ) { $campaigns = $donation->get_campaign_donations(); ob_start(); printf( ‘ %s ‘, __( ‘Campaign Stats’ ) ); foreach ( $campaigns as…Continue reading

Set Default Highlight Colour

/** * NOTE: This snippet will not work in versions of Charitable prior to 1.2. * * Set the default colour used by Charitable. * * @return string */ function en_set_default_highlight_colour() { return ‘#123456’; } add_filter( ‘charitable_default_highlight_colour’, ‘en_set_default_highlight_colour’ );Continue reading

Set Campaign Thumbnail Size

/** * If you want all campaign thumbnails to have the same size, you can use the * snippet below. Note that images will be hard-cropped, so part of the image * may be cropped out. * * If you…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

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

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

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

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