Skip to content

Instantly share code, notes, and snippets.

@bhwebworks
Last active January 22, 2016 00:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bhwebworks/4509cdde2c5c1f75b1be to your computer and use it in GitHub Desktop.
Save bhwebworks/4509cdde2c5c1f75b1be 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
<?php
/**
* 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 ){
// Setting $scheme = 'http' can help with mixed http/https front-end URLs
// Change it to 'https' if your site is using https
$home_url = home_url( $path = '', $scheme = 'http' );
$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

This is a copy of the original Gist found at https://gist.github.com/bhwebworks/5555641.

For some reason GitHub stopped allowing the original to be embedded, and since forking my own Gist isn't an option...

@bhwebworks
Copy link
Author

Added a variable for home_url() and the $scheme parameter to help with mixed http/https sites.

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