Search for keywords, like "PayPal", "Recurring Donations", and more.

Documentation / Developer Docs / Changing Form Label Text

Changing Form Label Text

Sometimes you want to update the text of your GiveWP forms. This is a list of actions you can use to do just that without editing the Core GiveWP plugin code at all.

“Select Payment Method” text

This appears under the main donation amount selection area and is where your donors choose which payment type they want. The example below changes that text to “Choose Your Payment Option”.

The "give_checkout_payment_method_text" filter

add_filter('give_checkout_payment_method_text', 'new_payment_text');

function new_payment_text() {	
	return __('Choose your Payment Option', 'give');
}

The “Personal Info” text

This is the section header for all the personal info you request from your donors. The example below changes that text to “Tell us about yourself”.

The "give_checkout_personal_info_text" filter

add_filter('give_checkout_personal_info_text', 'new_personal_info_text');

function new_personal_info_text() {	
	return __('Tell us about yourself', 'give');
}

Customizing Gateway Labels

Sometimes you may want to change a gateway’s label depending on your requirements. For instance, you may want to change “Offline Donations” to “Pay by Check”. Here’s the code to adjust the gateway:

Customize the Gateways Labels

/**
 * Customize the Gateways Labels
 *
 * @description: This function uses the `give_payment_gateways` library and adjusts the label that appears for the donor on the frontend donation forms. This will affect ALL donation forms.
 *
 * @param $gateways
 *
 * @return mixed
 */
function my_custom_gateway_labels($gateways) {
	$gateways['offline'] = array(
		'admin_label'    => 'Offline Donations',
		'checkout_label' => __( 'Mail a Check', 'give' )
	);
	$gateways['paypal'] = array(
		'admin_label'    => 'PayPal Standard',
		'checkout_label' => __( 'Credit/Debit Card or PayPal', 'give' )
	);

    return $gateways;
}

add_filter('give_payment_gateways', 'my_custom_gateway_labels');

Using these Filters Per Form

The code examples above change these labels globally. If you want to target a specific form to apply these labels to, you can pass the form or post id as a conditional.

The example below targets a form with the ID of “89”. Note that this will only work for single GiveWP form pages, not when the form is output via the shortcode.

Conditionally targeting one form

function new_personal_info_text($post) {
    global $post;
    
    if ( $post->ID == '89' ) {
	return __('Tell us about yourself', 'give');
    } else {
    return __('Personal Info', 'give');
    }
}

Need Help Implementing this code?

This document is provided for developers primarily. But many GiveWP users want to do things like this as well. If you would like to implement code like this in your WordPress site but don’t know how, we have this article for you.

Last updated 2 years ago

Start Fundraising Better Today!

Get GiveWP Today
GiveWP Plans

Give Fundraising Newsletter

The Give Fundraising Newsletter will help you navigate the world of online fundraising like a pro. Each week we send out fundraising advice, Give LIVE announcements, and exclusive offers to our newsletter subscribers.