Skip to content

Instantly share code, notes, and snippets.

@pbrocks
Created August 1, 2018 20:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pbrocks/c195b6798c1b94af9f3e42b8ef7de5e7 to your computer and use it in GitHub Desktop.
Save pbrocks/c195b6798c1b94af9f3e42b8ef7de5e7 to your computer and use it in GitHub Desktop.
Set the default country to United Kingdom/Great Britain using the GB abbreviation. States will be from the GB list. Rename State with a gettext filter.
<?php
/**
* [gettext_pmpro_checkout_city_state_postcode description]
*
* @param [type] $translated_text [description]
* @param [type] $original_text [description]
* @param [type] $domain [description]
*
* @return [type] [description]
*/
function gettext_pmpro_checkout_city_state_postcode( $translated_text, $original_text, $domain ) {
if ( $domain == 'pmpro' || $domain == 'paid-memberships-pro' ) {
if ( $translated_text == 'City, State Zip' ) {
$translated_text = 'City, County, Post Code';
}
if ( $translated_text == 'State' ) {
$translated_text = 'County';
}
if ( $translated_text == 'Zip' || $translated_text == 'Zipcode' ) {
$translated_text = 'Post Code';
}
}
return $translated_text;
}
add_filter( 'gettext', 'gettext_pmpro_checkout_city_state_postcode', 10, 3 );
/**
* [filter_pmpro_default_country description]
*
* @param [type] $default_country [description]
*
* @return [type] [description]
*/
function filter_pmpro_default_country( $default_country ) {
$default_country = 'GB';
return $default_country;
};
add_filter( 'pmpro_default_country', 'filter_pmpro_default_country', 10, 2 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment