Last active
June 21, 2017 20:37
-
-
Save fervous/366a5f86016eb3d94eba5139e2473f93 to your computer and use it in GitHub Desktop.
add gender or custom field to store-settings and admin for users wc vendors pro
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
/* adds the field to the store-settings form and signup form */ | |
add_action( 'wcvendors_settings_after_shop_description', 'store_gender' ); | |
function store_gender( ){ | |
if ( class_exists( 'WCVendors_Pro' ) ){ | |
$key = '_wcv_custom_settings_gender'; | |
$value = get_user_meta( get_current_user_id(), $key, true ); | |
// Gender | |
WCVendors_Pro_Form_Helper::input( array( | |
'id' => $key, | |
'label' => __( 'Your Gender', 'wcvendors-pro' ), | |
'placeholder' => __( 'Are you male or female?', 'wcvendors-pro' ), | |
'desc_tip' => 'true', | |
'description' => __( 'Your Gender', 'wcvendors-pro' ), | |
'type' => 'text', | |
'value' => $value, | |
) | |
); | |
} | |
} | |
/* adds field to the admin user screen */ | |
add_action( 'wcvendors_admin_after_shop_name', 'wcv_custom_settings_gender_admin' ); | |
function wcv_custom_settings_gender_admin( $user ) { | |
?> | |
<tr> | |
<th><label for="_wcv_custom_settings_gender"><?php _e( 'Gender', 'wcvendors-pro' ); ?></label></th> | |
<td><input type="text" name="_wcv_custom_settings_gender" id="_wcv_custom_settings_gender" value="<?php echo get_user_meta( $user->ID, '_wcv_custom_settings_gender', true ); ?>" class="regular-text"></td> | |
</tr> | |
<?php | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment