Place the code below into your functions.php file to add custom user profile fields. Edit or add lines as you see fit.
Remember not to remove the line: return $contactmethods; otherwise this won’t work.
<br />// CUSTOM USER PROFILE FIELDS<br /> function my_custom_userfields( $contactmethods ) {<br /> // ADD CONTACT CUSTOM FIELDS<br /> $contactmethods['contact_phone_office'] = 'Office Phone';<br /> $contactmethods['contact_phone_mobile'] = 'Mobile Phone';<br /> $contactmethods['contact_office_fax'] = 'Office Fax';<br /> // ADD ADDRESS CUSTOM FIELDS<br /> $contactmethods['address_line_1'] = 'Address Line 1';<br /> $contactmethods['address_line_2'] = 'Address Line 2 (optional)';<br /> $contactmethods['address_city'] = 'City';<br /> $contactmethods['address_state'] = 'State';<br /> $contactmethods['address_zipcode'] = 'Zipcode';<br /> return $contactmethods;<br /> }<br /> add_filter('user_contactmethods','my_custom_userfields',10,1);<br />
To display custom fields you can use one of the two methods listed below.
Option 1:the_author_meta('facebook', $current_author->ID);
Option 2:
<br /><?php $current_author = get_userdata(get_query_var('author')); ?><br /><a href="<?php echo esc_url($current_author-&gt;contact_phone_office);?>" title="office_phone"> Office Phone</a><br />
In this way you can add custom fields in user profile