Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save dwanjuki/bc1194e5edf4a8b7ba7cde4aa4e21604 to your computer and use it in GitHub Desktop.
Save dwanjuki/bc1194e5edf4a8b7ba7cde4aa4e21604 to your computer and use it in GitHub Desktop.
Change the word "Seat(s)" to "Membership(s)" for the Group Accounts Add On
<?php
/**
* This will change all instances of seat(s) to membership(s) for the Group Accounts Add On
*
* You can add this recipe to your site by creating a custom plugin
* or using the Code Snippets plugin available for free in the WordPress repository.
* Read this companion article for step-by-step directions on either method.
* https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
*/
function my_pmpro_group_accounts_gettext_seat( $output_text, $input_text, $domain ) {
if ( 'pmpro-group-accounts' === $domain ) {
$output_text = str_replace( 'Seat', 'Membership', $output_text );
$output_text = str_replace( 'seat', 'membership', $output_text );
}
return $output_text;
}
add_filter( 'gettext', 'my_pmpro_group_accounts_gettext_seat', 10, 3 );
// Support _n calls.
function my_pmpro_group_accounts_ngettext_seat( $output_text, $single, $plural, $number, $domain ) {
if ( $number == 1 ) {
return my_pmpro_group_accounts_gettext_seat( $output_text, $single, $domain );
} else {
return my_pmpro_group_accounts_gettext_seat( $output_text, $plural, $domain );
}
}
add_filter( 'ngettext_pmpro-group-accounts', 'my_pmpro_group_accounts_ngettext_seat', 10, 5 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment