Last active
August 29, 2015 14:04
-
-
Save billerickson/77a249a56156702f4a41 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 | |
/** | |
* Enqueue Inline Styles | |
* | |
* @author Bill Erickson | |
* @link http://www.billerickson.net/code/enqueue-inline-styles/ | |
*/ | |
function be_enqueue_inline_styles() { | |
$css = ''; | |
$logo = get_option( 'options_be_site_logo' ); | |
if( $logo ) { | |
$logo = wp_get_attachment_image_src( $logo, 'full' ); | |
$css .= ' | |
.site-title { background-image: url(' . $logo[0] . ');} | |
'; | |
} | |
if( !empty( $css ) ) | |
wp_add_inline_style( 'child-theme', $css ); | |
} | |
add_action( 'wp_enqueue_scripts', 'be_enqueue_inline_styles' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment