Skip to content

Instantly share code, notes, and snippets.

@rfmeier
Created June 3, 2013 14:25
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 rfmeier/5698524 to your computer and use it in GitHub Desktop.
Save rfmeier/5698524 to your computer and use it in GitHub Desktop.
Modify Genesis author box html.
<?php
add_filter( 'genesis_author_box', 'custom_genesis_author_box', 10, 6 );
/**
* Callback for Genesis 'genesis_author_box' filter.
*
* Change the title element from H1 to H3. Move the gravatar to the right.
* Make sure to adjust the css for the .author-box .avatar to align: right
*
* @package Genesis
* @category Author
* @author Ryan Meier <rfmeier@gmail.com>
* @link http://my.studiopress.com/snippets/author-box/
*
* @param string $author_box_html the initial end result author box html
* @param string $context the current context
* @param string $pattern the string pattern (used in sprintf and printf)
* @param string $gravatar the gravatar html
* @param string $title the title
* @param string $description the author description
* @return string the end result author box html
*/
function custom_genesis_author_box( $author_box_html, $context, $pattern, $gravatar, $title, $description ){
// if genesis 2.0+
if ( genesis_html5() ) {
$pattern = sprintf( '<section %s>', genesis_attr( 'author-box' ) );
// changed h1 to h3 and moved gravatar after the title
$pattern .= '<h3 class="author-box-title">%s</h3>%s';
$pattern .= '<div class="author-box-content" itemprop="description">%s</div>';
$pattern .= '</section>';
}else{ // pre genesis 2.0
// changed h1 to h3 and moved gravatar after the title
$pattern = 'single' == $context ? '<div class="author-box"><div>%s %s<br />%s</div></div>' : '<div class="author-box"><h3>%s</h3>%s<div>%s</div></div>';
}
// moved $gravatar after $title
return sprintf( $pattern, $title, $gravatar, $description );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment