Skip to content

Instantly share code, notes, and snippets.

@bhwebworks
Last active December 17, 2015 05:09
Show Gist options
  • Save bhwebworks/5555641 to your computer and use it in GitHub Desktop.
Save bhwebworks/5555641 to your computer and use it in GitHub Desktop.
Filter the genesis_seo_site_title function to use an image for the logo instead of a background image
/**
* Filter the genesis_seo_site_title function to use an image for the logo instead of a background image
*
* The genesis_seo_site_title function is located in genesis/lib/structure/header.php
* @link http://blackhillswebworks.com/?p=4144
*
*/
add_filter( 'genesis_seo_title', 'bhww_filter_genesis_seo_site_title', 10, 2 );
function bhww_filter_genesis_seo_site_title( $title, $inside ){
$child_inside = sprintf( '<a href="%s" title="%s"><img src="'. get_stylesheet_directory_uri() .'/images/logo.png" title="%s" alt="%s"/></a>', trailingslashit( home_url() ), esc_attr( get_bloginfo( 'name' ) ), esc_attr( get_bloginfo( 'name' ) ), esc_attr( get_bloginfo( 'name' ) ) );
$title = str_replace( $inside, $child_inside, $title );
return $title;
}
@bhwebworks
Copy link
Author

Edit: updated again on July 5, 2013. After further discussion in the blog post comments and pondering this issue, I’ve decided to undo yesterday’s change. Opinions seem to be evenly split on whether or not to include hidden text with an image inside H1 tags: for example, see this thread and this thread on Stackoverflow. Beyond those two threads, this video from Google Webmasters carried considerable weight in my decision. Finally, analyzing my home page with this tool from Seoptimer showed that the image alt attribute for the logo was being used as the text for the H1 tag on the home page.

(Personally, I don’t think that hiding only the H1 tag text on the home page is going to be frowned on by Google, but why take that chance when the image alt text also seems to work?)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment