Home / Admin / Changing Text For Suggestion Donation Descriptions
Duplicate Snippet

Embed Snippet on Your Site

Changing Text For Suggestion Donation Descriptions

You can place this code in your theme functions.php or use WPCode.

Code Preview
php
<?php
add_filter( 'charitable_campaign_suggested_donations', 'example_charitable_campaign_suggested_donations', 10, 2 );
function example_charitable_campaign_suggested_donations( $value = array(), $campaign_object ) {
	if ( empty( $value ) ) {
		return;
	}
	/*
	$value is an array of suggested donations. It often looks like this by default:
	Array
	(
	[1] => Array
		(
			[amount] => 5
			[description] => This is a small donation.
		)
	[2] => Array
		(
			[amount] => 10
			[description] => This is a slightly larger donation.
		)
	[3] => Array
		(
			[amount] => 15
			[description] => This is a larger (and default) donation.
		)
	[4] => Array
		(
			[amount] => 20
			[description] => This is a large donation.
		)
	) */
	// You can modify the array as needed. For example, you could change the description of an amount.
	$value[1]['description'] = 'This is a VERY small donation.';
	return $value;
}

Comments

Add a Comment