Do you think WordPress has a user-friendly interface ? Of-course I do, not just because of its interface, but its ability to extend features to meet the required needs. For instance, in WordPress user profile editor under Contact Info section you can add E-mail, Website, AIM, Yahoo IM & Google Talk.
WAIT! What if you need to add Twitter account in user profile or may be Facebook account in WordPress user profile ? Well, by default there is no space made by WordPress developers yet. I really wonder why do they ignore Twitter and Facebook or may be they don’t bother. Anyway, you don’t have to worry as WordPress is capable of extending its features, hence you can extend Contact Info of author profile. In this article, we will learn How to Extend Contact details of Author Profile in WordPress blog.
Getting Started
Before we start with the tutorial, I want you to make sure that your WordPress, Plugins and Theme are updated with latest versions. If you are using Thesis Theme then you can Safely upgrade to latest version Thesis.
Add Contact Options in User Profile
WordPress uses filters to override its default functions, and to extend WordPress Contact options it requires to create a filter. Find the code below and paste contact info filter in function.php file of the currently activated theme. If you are using Thesis Theme, then paste the code in custom_functions.php file. PHP code is as under:
NOTE: Make sure you take full backup of functions.php file or custom_functions.php file using FTP before modifying the original file or you can also refer to the article about how to safely edit custom_functions.php.
/* * Author: Aky Joe * Edit Custom Author Fields */ function extend_author_profile_joe( $joefields ) { $joefields['twitter'] = 'Twitter'; return $joefields; } add_filter('user_contactmethods','extend_author_profile_joe',10,1);
Above code will add Twitter option field in user profile under Dashboard Admin. Once you have added the code, save the file and upload it to server using FTP. Navigate to Dashboard Admin > Users > Your Profile and look for Twitter under contact info, similar to the screenshot below:
Embed Contact option in Theme
In a WordPress blog, Contact Info options are often used in Single Posts, for instance in Author Bio, Bylines & etcetera. To show Contact Info option in Theme requires, a PHP code to be added within the Post Loop in Single.php. Thesis Theme users can refer to Add Author Bio below single post in Thesis WordPress Theme. PHP Code to embed contact option is as under:
< ?php the_author_meta( 'twitter' ); ?>
Was that easy ?
I hope it was and in similar fashion you can extend contact details in WordPress. You can play or innovate the above code to meet your requirements, like adding facebook account in user profile, custom image urls in user profile and so on.
Can’t figure out a word above ? then you can also hire me to do extend Contact Options for WordPress. Else if you have any query or further assistance is required, post your feedback as a comment below.