Skip to content

Instantly share code, notes, and snippets.

@thewebprincess
Last active Aug 29, 2015
Embed
What would you like to do?
Code for Switching out the Genesis Header Image which is placed in the background of the header div by default with an inline image. Be prepared that you'll probably have to do some tweaking of your stylesheet to make things look 'just so' but this will get things heading in the right direction.
<?php
/** The first step is to remove the Genesis Custom Header function... */
/** Add support for custom header */
// add_theme_support( 'genesis-custom-header', array( 'width' => 1140, 'height' => 120 ) );
/** The Second step filters the Genesis SEO Title Function... */
add_filter( 'genesis_seo_title', 'twp_genesis_replace_header_background_img', 10, 2 );
/**
* Filter the genesis_seo_site_title function to insert an inline 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://thewebprincess.com/?p=3350
*
*/
function twp_genesis_replace_header_background_img( $title, $inside ){
$inline_logo = 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, $inline_logo, $title );
return $title;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment