msgbartop
ASP.NET : C#: VB.NET : SQL Server : Oracle : Sharepoint : PHP : SSIS : SSRS : Wordpress : Plugins : Technology News
msgbarbottom

30 Jan 11 How to Add Extra Contact Info or Remove Existing Info from WordPress

One day I was looking WordPress documentation to find some methods to add author box, I come across with this $contactmethods which can be used to add or remove fields from contact information section of WordPress. I am using 3.0 and I tried only on this version so not sure if it will work on older version of WordPress.

You need to add some lines of code in the Theme Functions (Functions.php) file comes in your theme. This is useful when you want to add your Twitter or Facebook account in you author profile page. Also, in the code you can add code lines to remove any existing field from contact info page. If you just want to remove existing profile field then do not use code to add new fields from the below snippet. Here is the code snippet for that, which you can add before ?> OR right after <?php -

function add_myExtra_ContactMethod( $contactmethods ) {
// Add Twitter
$contactmethods['twitter'] = 'Twitter';
// Add Facebook
$contactmethods['facebook'] = 'Facebook';

//Remove Jabber / Google Talk
unset($contactmethods['jabber']);

return $contactmethods;
}

add_filter('user_contactmethods','add_myExtra_ContactMethod',10,1);

After adding this, if you will look into User Profile page, you will see 2 new profile fields and 1 Google Talk profile field missing -
Extra Profile Fields

Here is one more field which you may want to add to use in Authors profile display and that is for gender. Gender info you can later use to write “His/He” or “Her/She” in general description. For this just add something like this in above mentioned code -

// Add Gender
$contactmethods['sex'] = 'Sex (male/female)';