Skip to content

Instantly share code, notes, and snippets.

@ramseyp
Created January 12, 2013 18:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ramseyp/4519891 to your computer and use it in GitHub Desktop.
Save ramseyp/4519891 to your computer and use it in GitHub Desktop.
Add an author box to an author archive in a Genesis child theme. Place this in your functions.php for your child theme.
<?php
/**
*
* Add author box before the loop on an author archive.
* Grabs the ID from the query. On an author archive, this the author ID.
* get_the_author_meta() is used to retrieve the various meta: user_nicename, description, etc.
* http://codex.wordpress.org/Function_Reference/get_the_author_meta
*
*/
add_action('genesis_before_loop', 's25_custom_author_box_archive');
function s25_custom_author_box_archive() {
if ( is_author() ) {
$auth_id = get_queried_object()->ID; //Get the author ID from the query
echo '<div class="author-box">';
echo get_avatar( $auth_id, 100 );
echo '<h2>' . get_the_author_meta( 'user_nicename', $auth_id ) . '</h2>';
echo '<p>' . get_the_author_meta( 'description', $auth_id ) . '</p>';
echo '</div>';
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment