Skip to content

Instantly share code, notes, and snippets.

@whyisjake
Created October 16, 2013 23:45
Show Gist options
  • Save whyisjake/7016947 to your computer and use it in GitHub Desktop.
Save whyisjake/7016947 to your computer and use it in GitHub Desktop.
<?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