Created
October 16, 2013 23:45
-
-
Save whyisjake/7016947 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 our current authors info | |
$author = get_queried_object(); | |
// Contains the username which should match the Gravatar account URL. | |
$gravatar_login = $author->data->user_login; | |
// Get all the Coauthor Plus data | |
$coauthor = array_shift( get_coauthors() ); | |
// Get the authors name and store it in a variable | |
$author_name = $coauthor->display_name; | |
// Contain our coauthor email into a variable. This may be overwritten when account is linked | |
$avatar_email = $coauthor->user_email; | |
// Setup some new variables or override some when an author is linked. | |
if ( ! empty( $author->linked_account ) ) { | |
// We need the ID of the linked author so we can get their posts. | |
$linked_author = get_user_by( 'slug', $author->linked_account ); | |
// Return the linked authors name | |
$author_name = $linked_author->display_name; | |
// When an account is linked, we want to add this email into mix to see if we return gravatar data | |
$gravatar_login = $linked_author->user_login; | |
// Set linked account email as the gravatar email | |
$avatar_email = $linked_author->user_email; | |
} | |
make_get_header(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment