This is a nice way to display some extra fields for your blog users so they can display it on theire profile page..
Also you can show them if you are using a custom author.php page.
Ok lets start here by first opening your function.php and adding this code to it.
Simply copy and paste the code at the bottom of your function.php
/* BEGIN Custom User Contact Info */
function extra_contact_info($contactmethods) {
unset($contactmethods['aim']);
unset($contactmethods['yim']);
unset($contactmethods['jabber']);
$contactmethods['facebook'] = 'Facebook';
$contactmethods['twitter'] = 'Twitter';
$contactmethods['linkedin'] = 'LinkedIn';
$contactmethods['phonenumber'] = 'Phone Number';
$contactmethods['country'] = 'Country';
return $contactmethods;
}
add_filter('user_contactmethods', 'extra_contact_info');
/* END Custom User Contact Info */
Now fun part..
in your custom author.php page you can add this code so you can display it on your blog just like we have here.
And you can just keep adding as much as you want and what you want,, the sky is the limit.
<strong>< ?php _e('Member Since:','cp');?></strong> < ?php echo date_i18n(get_option('date_format'), strtotime($curauth->user_registered)); ?>
<strong>< ?php _e('Website:','cp'); ?></strong> <a href="<?php echo $curauth->user_url; ?>">< ?php echo $curauth->user_url; ?></a>
< ?php $user_info = get_userdata(1); echo('<strong>FaceBook: ' . $user_info->facebook . "\n");?>
< ?php $user_info = get_userdata(1); echo('</strong><strong>Twitter: ' . $user_info->twitter . "\n");?>
< ?php $user_info = get_userdata(1); echo('</strong></strong><strong>Phone Number: ' . $user_info->phonenumber . "\n");?>
< ?php $user_info = get_userdata(1); echo('</strong></strong><strong>Country: ' . $user_info->country . "\n");?>
</strong>
Hhere is the new and update version
<?php
function list_pings($comment, $args, $depth) {
$GLOBALS['comment'] = $comment;
?>
<li id="comment-<?php comment_ID(); ?>"><?php comment_author_link(); ?>
<?php } ?>
<?php
add_action('show_user_profile', 'wpsplash_extraProfileFields');
add_action('edit_user_profile', 'wpsplash_extraProfileFields');
add_action('personal_options_update', 'wpsplash_saveExtraProfileFields');
add_action('edit_user_profile_update', 'wpsplash_saveExtraProfileFields');
function wpsplash_saveExtraProfileFields($userID) {
if (!current_user_can('edit_user', $userID)) {
return false;
}
update_usermeta($userID, 'phonenumber', $_POST['phonenumber']);
update_usermeta($userID, 'country', $_POST['country']);
update_usermeta($userID, 'twitter', $_POST['twitter']);
update_usermeta($userID, 'facebook', $_POST['facebook']);
update_usermeta($userID, 'linkedin', $_POST['linkedin']);
update_usermeta($userID, 'digg', $_POST['digg']);
update_usermeta($userID, 'flickr', $_POST['flickr']);
}
function wpsplash_extraProfileFields($user)
{
function short_title($after = null, $length) {
$mytitle = get_the_title();
$size = strlen($mytitle);
if($size>$length) {
$mytitle = substr($mytitle, 0, $length);
$mytitle = explode(' ',$mytitle);
array_pop($mytitle);
$mytitle = implode(" ",$mytitle).$after;
}
return $mytitle;
}
?>
<h3>Connect Information</h3>
<table class='form-table'>
<tr>
<th><label for='flickr'>Country</label></th>
<td>
<input type='text' name='country' id='country' value='<?php echo esc_attr(get_the_author_meta('country', $user->ID)); ?>' class='regular-text' />
<br />
<span class='description'>Please enter your State or County. </span>
</td>
</tr>
<tr>
<th><label for='flickr'>Phone Number</label></th>
<td>
<input type='text' name='phonenumber' id='phonenumber' value='<?php echo esc_attr(get_the_author_meta('phonenumber', $user->ID)); ?>' class='regular-text' />
<br />
<span class='description'>Please enter your Phone Number. </span>
</td>
</tr>
<tr>
<th><label for='twitter'>Twitter</label></th>
<td>
<input type='text' name='twitter' id='twitter' value='<?php echo esc_attr(get_the_author_meta('twitter', $user->ID)); ?>' class='regular-text' />
<br />
<span class='description'>Please enter your Twitter username. http://www.twitter.com/<strong>username</strong></span>
</td>
</tr>
<tr>
<th><label for='facebook'>Facebook</label></th>
<td>
<input type='text' name='facebook' id='facebook' value='<?php echo esc_attr(get_the_author_meta('facebook', $user->ID)); ?>' class='regular-text' />
<br />
<span class='description'>Please enter your Facebook username. http://www.facebook.com/<strong>username</strong></span>
</td>
</tr>
<tr>
<th><label for='linkedin'>LinkedIn</label></th>
<td>
<input type='text' name='linkedin' id='linkedin' value='<?php echo esc_attr(get_the_author_meta('linkedin', $user->ID)); ?>' class='regular-text' />
<br />
<span class='description'>Please enter your LinkedIn username. http://www.linkedin.com/in/<strong>username</strong></span>
</td>
</tr>
<tr>
<th><label for='digg'>Digg</label></th>
<td>
<input type='text' name='digg' id='digg' value='<?php echo esc_attr(get_the_author_meta('digg', $user->ID)); ?>' class='regular-text' />
<br />
<span class='description'>Please enter your Digg username. http://digg.com/users/<strong>username</strong></span>
</td>
</tr>
<tr>
<th><label for='flickr'>Flickr</label></th>
<td>
<input type='text' name='flickr' id='flickr' value='<?php echo esc_attr(get_the_author_meta('flickr', $user->ID)); ?>' class='regular-text' />
<br />
<span class='description'>Please enter your flickr username. http://www.flickr.com/photos/<strong>username</strong>/</span>
</td>
</tr>
</table>
<?php } ?>
Click here to go to a sample Profile Page
Popularity: 90%
This code’s lifesaver!!! Thank you!!! Thank you!!! Thank you!!! Thank you!!! Thank you!!! Thank you!!! Thank you!!!
You are welcome There is a new version that will display only fields that are entered by user, I will ad the update latter on.
I’ve been looking around for a way to insert two photos for an author, and I can see that you somehow accomplished that (by looking at the screenshot above).
But in the code you write, that part isn’t written.
Can you help me with this?
hi nichive, the photo that you see is just a plug-in that i am using and the plug in is User Avatar and it can also be done manually, let see if i can come up with something but now i can do much cause i am on vacation and will be returning in couple of months. Sorry that i cant help you right now.
very nice code.
thanks brother for shareing with us
You are welcome my friend hope you can make use of it..
I’ve been exploring for a little for any high-quality articles or blog posts on this sort of house . Exploring in Yahoo I finally stumbled upon this web site. Reading this information So i am happy to convey that I have an incredibly just right uncanny feeling I found out just what I needed. I most no doubt will make certain to don?t disregard this website and provides it a look regularly.
I have been exploring for a little bit for any high-quality articles or weblog posts on this kind of house . Exploring in Yahoo I at last stumbled upon this website. Reading this information So i am satisfied to convey that I have an incredibly just right uncanny feeling I discovered just what I needed. I most undoubtedly will make certain to don?t disregard this web site and provides it a glance regularly.
After study just a few of the blog posts in your web site now, and I really like your method of blogging. I bookmarked it to my bookmark web site list and will likely be checking back soon. Pls take a look at my site as nicely and let me know what you think.
I got what you intend, appreciate it for putting up.Woh I am thankful to find this website through google.
I�ve read several good stuff here. Certainly worth bookmarking for revisiting. I surprise how much effort you put to create such a magnificent informative website.
Hey guys I will work on the new code that will be easy to use and much more stable.
Hey there, You have performed a fantastic job. I will definitely digg it and in my opinion suggest to my friends. I am confident they’ll be benefited from this site.
I don’t even understand how I ended up here, but I believed this publish was great. I do not understand who you’re however certainly you are going to a famous blogger when you are not already. Cheers!
Its like you read my mind! You seem to understand a lot about this, like you wrote the guide in it or something. I think that you just could do with a few p.c. to pressure the message home a bit, however instead of that, this is fantastic blog. A great read. I will definitely be back.
It’s really a cool and useful piece of information. I am satisfied that you just shared this helpful information with us. Please stay us informed like this. Thank you for sharing.
Its going to be finish of mine day, but before finish I am reading this great paragraph to improve my experience.|
Very nice post. I simply stumbled upon your blog and wished to say that I have really enjoyed browsing your weblog posts. After all I’ll be subscribing for your rss feed and I am hoping you write again very soon!
I used to be recommended this website by way of my cousin. I’m now not certain whether or not this publish is written by him as no one else realize such specified about my trouble. You’re wonderful! Thanks!
Unquestionably believe that that you stated. Your favourite reason seemed to be at the internet the simplest factor to consider of. I say to you, I definitely get annoyed whilst folks think about issues that they plainly don’t realize about. You managed to hit the nail upon the top and outlined out the entire thing with no need side effect , other people could take a signal. Will likely be again to get more. Thanks
Rattling superb info can be found on web site.