我正在使用WordPress woocommerce plugin
制作eCommerce site
。关于woocommerce plugin
的一切都很好。但是,当我看到用户register
所在的register all of his details
部分时,custom fields
没有gender, phone no, address etc
。我需要register page
中的所有这些内容。那怎么办呢?任何帮助建议都会非常明显。
答案 0 :(得分:3)
此插件正是您正在寻找的http://wordpress.org/extend/plugins/cimy-user-extra-fields/。您将能够在注册表单中添加额外的字段,并将其添加到用户的用户个人资料页面中。
下面是样本注册表单http://wordpress.org/extend/plugins/cimy-user-extra-fields/screenshots/
的屏幕截图我个人在http://mayumibeats.com/wp-signup.php?blog_id=1
使用此功能干杯!
答案 1 :(得分:0)
您可以添加自己的字段,将以下代码添加到wordpress主题functions.php文件中。
/**
* Add new register fields for WooCommerce registration.
*
* @return string Register fields HTML.
*/
function wooc_extra_register_fields() {
?>
<p class="form-row form-row-first">
<label for="reg_billing_first_name"><?php _e( 'First name', 'woocommerce' ); ?> <span class="required">*</span></label>
<input type="text" class="input-text" name="billing_first_name" id="reg_billing_first_name" value="<?php if ( ! empty( $_POST['billing_first_name'] ) ) esc_attr_e( $_POST['billing_first_name'] ); ?>" />
</p>
<p class="form-row form-row-last">
<label for="reg_billing_last_name"><?php _e( 'Last name', 'woocommerce' ); ?> <span class="required">*</span></label>
<input type="text" class="input-text" name="billing_last_name" id="reg_billing_last_name" value="<?php if ( ! empty( $_POST['billing_last_name'] ) ) esc_attr_e( $_POST['billing_last_name'] ); ?>" />
</p>
<div class="clear"></div>
<p class="form-row form-row-wide">
<label for="reg_billing_phone"><?php _e( 'Phone', 'woocommerce' ); ?> <span class="required">*</span></label>
<input type="text" class="input-text" name="billing_phone" id="reg_billing_phone" value="<?php if ( ! empty( $_POST['billing_phone'] ) ) esc_attr_e( $_POST['billing_phone'] ); ?>" />
</p>
<?php
}
add_action( 'woocommerce_register_form_start', 'wooc_extra_register_fields' );
您可以将字段修改为textbox,radiobutton或任何您需要的字段。
希望有所帮助:)
马努。
答案 2 :(得分:-1)
您必须编辑插件文件才能拥有此功能。可能需要更改的文件是
不需要数据库更改,因为条目将保存在wp_usermeta表中。
如果您通过Wordpress的注册页面注册用户,请使用Cimy User Extra Fields等插件