Display Author’s Twitter and Facebook Information on their Profile Page

Posted on January 22nd, 2011

WordPress has fields for author contacts, but it has not been updated in ages. So by default there is no option to add author’s twitter or facebook. With this hack the information can be added on their profile page.

First paste the following code in functions.php:

<?php
function my_new_contactmethods( $contactmethods ) {
// Add Twitter
$contactmethods['twitter'] = ‘Twitter’;
//add Facebook
$contactmethods['facebook'] = ‘Facebook’;

return $contactmethods;
}
add_filter(‘user_contactmethods’,'my_new_contactmethods’,10,1);
?>

The above code will add two extra fields on user-edit page named twitter and Facebook. Display the code with the following code in your author.php file.

<?php echo $curauth->twitter; ?>