Skip to content

Instantly share code, notes, and snippets.

@billerickson
Created March 22, 2012 22:07
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save billerickson/2164985 to your computer and use it in GitHub Desktop.
Save billerickson/2164985 to your computer and use it in GitHub Desktop.
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;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment