Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- add_filter('wcfm_membership_registration_fields', function ($fields) {
- foreach(['first_name','last_name'] as $field_name) {
- if (isset($fields[$field_name])) {
- if (isset($fields[$field_name]['custom_attributes']) && is_array($fields[$field_name]['custom_attributes'])) {
- $fields[$field_name]['custom_attributes']['required'] = true;
- } else {
- $fields[$field_name]['custom_attributes'] = ['required' => true];
- }
- }
- }
- return $fields;
- });
- add_filter('wcfm_membership_registration_fields_address', function ($fields) {
- if (isset($fields['city'])) {
- if (isset($fields['city']['custom_attributes']) && is_array($fields['city']['custom_attributes'])) {
- $fields['city']['custom_attributes']['required'] = true;
- } else {
- $fields['city']['custom_attributes'] = ['required' => true];
- }
- }
- if (isset($fields['zip'])) {
- $fields['zip']['label'] = __('Postcode', 'wc-frontend-manager');
- }
- return $fields;
- });
- add_filter('wcfm_membership_registration_fields_phone', function ($fields) {
- if (isset($fields['phone'])) {
- $fields['phone']['label'] = __('Contact number', 'wc-frontend-manager');
- }
- return $fields;
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement