Add Custom User Profile Fields

Heres a little trick on how to add custom user profile fields.

Instructions
Add this code to your functions.php file and edit or add lines as you see fit.

function my_custom_userfields( $contactmethods ) {

    // ADD CONTACT CUSTOM FIELDS
    $contactmethods['contact_phone_office']     = 'Office Phone';
    $contactmethods['contact_phone_mobile']     = 'Mobile Phone';
    $contactmethods['contact_office_fax']       = 'Office Fax';
    
    return $contactmethods;
}
   add_filter('user_contactmethods','my_custom_userfields',10,1);

Displaying the Custom Userfields

1 Method:

<?php the_author_meta('contact_phone_office'); ?>

2 Method:

<?php the_author_meta('contact_phone_office', $current_author->ID) ?>

3 Method:

<?php $current_author = get_userdata(get_query_var('author')); ?>
<p><a href="<?php echo esc_url($current_author->contact_phone_office);?>" title="office_phone"> Office Phone</a></p>

Go to wp-snippet.com [source]