Last active
March 26, 2018 14:31
-
-
Save rickalee/eae68bfad7a81a1b6cc92f849b08dbbe to your computer and use it in GitHub Desktop.
Add Twitter handle/username to User Contact Information
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 Twitter handle/username to User Contact Information | |
* | |
* @param $user_contact | |
* | |
* @return array | |
*/ | |
function user_contact_add_twitter( $user_contact ) { | |
$user_contact['twitter'] = __( 'Twitter Username' ); | |
return $user_contact; | |
} | |
add_filter( 'user_contactmethods', 'user_contact_add_twitter' ); |
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 | |
/** | |
* Get Twitter username for current post author | |
*/ | |
$twitter = get_the_author_meta( 'twitter', get_the_author_meta( 'ID' ) ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment