Last active
November 17, 2017 14:27
-
-
Save Sstobo/b69f56d00b6235e5f8b96fc9fc8ff2cb to your computer and use it in GitHub Desktop.
[extras.php dynamic css generation] #php #fp
This file contains hidden or 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
function inhab_dynamic_css() { | |
if ( ! is_page_template( 'about.php')) { | |
return; | |
} | |
$image = CFS()->get('about_header_image') ; | |
if (! $image) { | |
return; | |
} | |
$hero_css = ".page-template-about .entry-header { | |
background: | |
linear-gradient( to bottom, rgba(0,0,0,0.4) 0%, rgba(0,0,0,0.4) 100% ), | |
url({$image}) no-repeat center bottom; | |
background-size: cover, cover; | |
}"; | |
wp_add_inline_style( 'tent-style', $hero_css ); | |
} | |
add_action( 'wp_enqueue_scripts', 'inhab_dynamic_css' ); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment