Skip to content

Instantly share code, notes, and snippets.

@billerickson
Last active August 29, 2015 14:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save billerickson/77a249a56156702f4a41 to your computer and use it in GitHub Desktop.
Save billerickson/77a249a56156702f4a41 to your computer and use it in GitHub Desktop.
<?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