Customize Author Box

<?php
add_filter( 'genesis_author_box', 'be_author_box', 10, 6 );
/**
* Customize Author Box
* @author Bill Erickson
* @link http://www.billerickson.net/code/customize-author-box
*
* @param string $output
* @param string $context
* @param string $pattern
* @param string $gravatar
* @param string $title
* @param string $description
* @return string $output
*/
function be_author_box( $output, $context, $pattern, $gravatar, $title, $description ) {
$output = '';
// Author box on single post
if( 'single' == $context ) {
$output .= '<div class="author-box">';
$output .= '<div class="left">';
$output .= get_avatar( get_the_author_meta( 'email' ), 200 );
$output .= '</div><!-- .left -->';
$output .= '<div class="right">';
$name = get_the_author();
$title = get_the_author_meta( 'title' );
if( !empty( $title ) )
$name .= ', ' . $title;
$output .= '<h4 class="title">' . $name . '</h4>';
$output .= '<p class="desc">' . get_the_author_meta( 'description' ) . '</p>';
$output .= '</div><!-- .right -->';
$output .= '<div class="cl"></div>';
$output .= '<div class="left"><p class="social">';
if( get_the_author_meta( 'twitter' ) )
$output .= '<a href="' . esc_url( get_the_author_meta( 'twitter' ) ) . '"><img src="' . get_stylesheet_directory_uri() . '/images/icon-twitter-author.png" /></a> ';
if( get_the_author_meta( 'gplus' ) )
$output .= '<a href="' . esc_url( get_the_author_meta( 'gplus' ) ) . '"><img src="' . get_stylesheet_directory_uri() . '/images/icon-gplus-author.png" /></a> ';
if( get_the_author_meta( 'linkedin' ) )
$output .= '<a href="' . esc_url( get_the_author_meta( 'linkedin' ) ) . '"><img src="' . get_stylesheet_directory_uri() . '/images/icon-linkedin-author.png" /></a> ';
$output .= '<a href="' . trailingslashit( get_author_posts_url( get_the_author_meta( 'ID' ) ) ) . 'feed"><img src="' . get_stylesheet_directory_uri() . '/images/icon-feed-author.png" /></a>';
$output .= '</div><!-- .left -->';
$output .= '<div class="right">';
$output .= '<p class="email"><a href="mailto:' . get_the_author_meta( 'email' ) . '">Email ' . get_the_author_meta( 'email' ) . '</a></p>';
$output .= '</div><!-- .right -->';
$output .= '</div><!-- .author-box -->';
} else {
$output .= '<div class="author-box">';
$output .= '<div class="left">';
$output .= get_avatar( get_the_author_meta( 'email' ), 200 );
$output .= '</div><!-- .left -->';
$output .= '<div class="right">';
$name = get_the_author();
$title = get_the_author_meta( 'title' );
if( !empty( $title ) )
$name .= ', ' . $title;
$output .= '<h4 class="title"><a href="' . get_author_posts_url( get_the_author_meta( 'ID' ) ) . '">' . $name . '</a>';
$output .= '<span class="social">';
if( get_the_author_meta( 'twitter' ) )
$output .= '<a href="' . esc_url( get_the_author_meta( 'twitter' ) ) . '"><img src="' . get_stylesheet_directory_uri() . '/images/icon-twitter-author.png" /></a> ';
if( get_the_author_meta( 'gplus' ) )
$output .= '<a href="' . esc_url( get_the_author_meta( 'gplus' ) ) . '"><img src="' . get_stylesheet_directory_uri() . '/images/icon-gplus-author.png" /></a> ';
if( get_the_author_meta( 'linkedin' ) )
$output .= '<a href="' . esc_url( get_the_author_meta( 'linkedin' ) ) . '"><img src="' . get_stylesheet_directory_uri() . '/images/icon-linkedin-author.png" /></a> ';
$output .= '<a href="' . trailingslashit( get_author_posts_url( get_the_author_meta( 'ID' ) ) ) . 'feed"><img src="' . get_stylesheet_directory_uri() . '/images/icon-feed-author.png" /></a>';
$output .= '</span>';
$output .= '<a class="email" href="mailto:' . get_the_author_meta( 'email' ) . '">Email ' . get_the_author_meta( 'email' ) . '</a>';
$output .= '</h4>';
$output .= '<p class="desc">' . get_the_author_meta( 'description' ) . '</p>';
$output .= '</div><!-- .right -->';
$output .= '</div><!-- .author-box -->';
}
return $output;
}
view raw functions.php hosted with ❤ by GitHub

Bill Erickson

Bill Erickson is the co-founder and lead developer at CultivateWP, a WordPress agency focusing on high performance sites for web publishers.

About Me
Ready to upgrade your website?

I build custom WordPress websites that look great and are easy to manage.

Let's Talk