Last active
February 3, 2017 08:16
-
-
Save rynaldos-zz/e216bd59fb3602b805ad11bfea747e49 to your computer and use it in GitHub Desktop.
[WordPress | WooCommerce] Change password strength meter labels
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// WordPress | |
add_action( 'wp_enqueue_scripts', 'my_strength_meter_localize_script' ); | |
function my_strength_meter_localize_script() { | |
wp_localize_script( 'password-strength-meter', 'pwsL10n', array( | |
'empty' => __( 'But... it\'s empty!', 'theme-domain' ), | |
'short' => __( 'Too short!', 'theme-domain' ), | |
'bad' => __( 'Not even close!', 'theme-domain' ), | |
'good' => __( 'You are getting closer...', 'theme-domain' ), | |
'strong' => __( 'Now, that\'s a password!', 'theme-domain' ), | |
'mismatch' => __( 'They are completely different, come on!', 'theme-domain' ) | |
) ); | |
} | |
// WooCommerce | |
add_filter( 'wc_password_strength_meter_params', 'my_strength_meter_custom_strings' ); | |
function my_strength_meter_custom_strings( $data ) { | |
$data_new = array( | |
'i18n_password_error' => esc_attr__( 'Come on, enter a stronger password.', 'theme-domain' ), | |
'i18n_password_hint' => esc_attr__( 'The password should be at least seven characters long.', 'theme-domain' ) | |
); | |
return array_merge( $data, $data_new ); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment