Skip to content

Instantly share code, notes, and snippets.

@ChrisCree
Last active December 31, 2015 19:19
Show Gist options
  • Save ChrisCree/8032515 to your computer and use it in GitHub Desktop.
Save ChrisCree/8032515 to your computer and use it in GitHub Desktop.
This will customize the Author Box display in Genesis 1.0+ HTML5. Just drop it in your child theme's functions.php file.
<?php
// Don't copy the opening php tag
// Modify the author box display
remove_action( 'genesis_after_entry', 'genesis_do_author_box_single', 8 );
add_action( 'genesis_before_comments', 'wsm_author_box', 8 );
remove_action( 'genesis_before_loop', 'genesis_do_author_box_archive', 15 );
add_action( 'genesis_before_loop', 'wsm_author_box', 8 );
function wsm_author_box() {
$authinfo = '';
$authdesc = get_the_author_meta('description');
if( !empty( $authdesc ) ) {
$authinfo .= sprintf( '<section %s>', genesis_attr( 'author-box' ) );
$authinfo .= '<h3 class="author-box-title">';
$authinfo .= __( 'About ', 'wsm' );
$authinfo .= '<span itemprop="name">';
$authinfo .= get_the_author_meta( 'display_name' );
$authinfo .= '</span>';
$authinfo .= '</h3>';
$authinfo .= get_avatar( get_the_author_id() , 90, '', get_the_author_meta( 'display_name' ) . '\'s avatar' ) ;
$authinfo .= '<div class="author-box-content" itemprop="description">';
$authinfo .= '<p>' . get_the_author_meta( 'description' ) . '</p>';
$authinfo .= '</div>';
$authinfo .= '</section>';
}
if ( is_author() || is_single() ) {
echo $authinfo;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment