apache_conf 将以下代码添加到主题的functions.php文件中,以在“我的帐户”下的注册表单中添加确认密码字段。
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了apache_conf 将以下代码添加到主题的functions.php文件中,以在“我的帐户”下的注册表单中添加确认密码字段。相关的知识,希望对你有一定的参考价值。
<?php
// Add the code below to your theme's functions.php file to add a confirm password field on the register form under My Accounts.
add_filter('woocommerce_registration_errors', 'registration_errors_validation', 10,3);
function registration_errors_validation($reg_errors, $sanitized_user_login, $user_email) {
global $woocommerce;
extract( $_POST );
if ( strcmp( $password, $password2 ) !== 0 ) {
return new WP_Error( 'registration-error', __( 'Passwords do not match.', 'woocommerce' ) );
}
return $reg_errors;
}
add_action( 'woocommerce_register_form', 'wc_register_form_password_repeat' );
function wc_register_form_password_repeat() {
?>
<p class="form-row form-row-wide">
<label for="reg_password2"><?php _e( 'Password Repeat', 'woocommerce' ); ?> <span class="required">*</span></label>
<input type="password" class="input-text" name="password2" id="reg_password2" value="<?php if ( ! empty( $_POST['password2'] ) ) echo esc_attr( $_POST['password2'] ); ?>" />
</p>
<?php
}
?>
以上是关于apache_conf 将以下代码添加到主题的functions.php文件中,以在“我的帐户”下的注册表单中添加确认密码字段。的主要内容,如果未能解决你的问题,请参考以下文章
apache_conf 将gzip压缩添加到.htaccess
apache_conf flexget配置将系列从sonarr添加到flexget
为 Woocommerce 电子邮件主题启用自定义字段占位符
apache_conf htaccess:assets(将css和js添加到项目中)
如何将函数调用添加到列表中?
将自定义 CSS 部分添加到 Shopify 主题