Created
January 16, 2014 06:21
-
-
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.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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