-
-
Save billerickson/cee137e430192972cbd8 to your computer and use it in GitHub Desktop.
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 | |
/** | |
* Site Header Background | |
* | |
* @author Bill Erickson | |
* @link http://www.billerickson.net/code/background-image-site-header/ | |
*/ | |
function be_site_header_background( $attributes ) { | |
$image = false; | |
if( is_page() ) | |
$image = get_post_meta( get_the_ID(), 'be_page_header', true ); | |
if( ! $image ) | |
return $output; | |
$image = wp_get_attachment_image_src( $image, 'full' ); | |
$attributes['class'] .= ' has-image'; | |
$attributes['style'] = 'background-image: url(' . $image[0] . ');'; | |
return $attributes; | |
} | |
add_filter( 'genesis_attr_site-header', 'be_site_header_background' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment