Skip to content

Instantly share code, notes, and snippets.

@kristarella
Created January 16, 2014 06:21
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kristarella/8450618 to your computer and use it in GitHub Desktop.
Save kristarella/8450618 to your computer and use it in GitHub Desktop.
Genesis child theme: use an HTML image for your custom header image instead of CSS background.
<?php
$header = array(
'default-image' => get_stylesheet_directory_uri().'/images/pageone.png',
'random-default' => false,
'width' => 320,
'height' => 60,
'flex-height' => true,
'flex-width' => true,
'default-text-color' => '#333333',
'header-text' => true,
'uploads' => true,
'wp-head-callback' => 'mytheme_do_site_title',
'admin-head-callback' => '',
'admin-preview-callback' => '',
);
add_theme_support( 'custom-header', $header );
function mytheme_do_site_title() {
add_filter('genesis_seo_title','mytheme_header_image',10,3);
}
function mytheme_header_image($title, $inside, $wrap) {
$inside = '
<a href="'.get_bloginfo('url').'">
<img src="'.get_header_image().'" height="'.get_custom_header()->height.'" width="'.get_custom_header()->width.'" alt="'.get_bloginfo('name').'" />
</a>';
return sprintf( "<{$wrap} %s>", genesis_attr( 'site-title' ) ) . "{$inside}</{$wrap}>";
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment