Skip to content

Instantly share code, notes, and snippets.

@matheuswd
Last active April 8, 2021 15:42
Show Gist options
  • Save matheuswd/381a70848630411f15b503c2768c3c03 to your computer and use it in GitHub Desktop.
Save matheuswd/381a70848630411f15b503c2768c3c03 to your computer and use it in GitHub Desktop.
This code changes the _Make this donation_ string
<?php
function my_give_text_switcher( $translation, $text, $domain ) {
if ( 'give-recurring' === $domain ) {
switch ( $translation ) {
/*
* Changes the "Make this Donation [monthly/weekly/daily]" text for
* a donor's choice recurring checkbox.
*/
case 'Make this donation %1$s' :
$translation = __( 'Make this membership automatically renew %1$s', 'give' );
break;
}
}
return $translation;
}
/**
* Conditional for gettext.
*
* @param $form_id
*/
function my_custom_give_confirm_form( $form_id ) {
// Customize form title here or remove conditional for all forms.
if ( $form_id == 2010 ) {
add_filter( 'gettext', 'my_give_text_switcher', 10, 3 );
}
}
add_action( 'give_pre_form_output', 'my_custom_give_confirm_form', 10, 1 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment