Created
July 16, 2013 04:07
-
-
Save gasatrya/6005684 to your computer and use it in GitHub Desktop.
Add custom fields to the author profile fields WordPress
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_filter( 'user_contactmethods', 'my_new_contactmethods', 10, 1 ); | |
/** | |
* Add custom fields to the author profile fields | |
* | |
*/ | |
function my_new_contactmethods( $contactmethods ) { | |
$contactmethods['twitter'] = 'Twitter'; // Add Twitter | |
$contactmethods['facebook'] = 'Facebook'; //add Facebook | |
return $contactmethods; | |
} | |
/* Display the field option 1 */ | |
the_author_meta( 'facebook', $current_author->ID ); | |
/* Display the field option 2 */ | |
$current_author = get_userdata( get_query_var( 'author' ) ); | |
?> | |
<p> | |
<a href="<?php echo esc_attr( $current_author->facebook );?>">Facebook</a> | |
</p> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment