Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
Inlining styles in WordPress without an actual CSS file
<?php
add_action( 'some_hook', 'maxslider_enqueue_slider_css' );
function maxslider_enqueue_slider_css() {
$css = '';
// ...
if ( true === $something ) {
$css = 'body { background-color: ' . $color . '; }';
}
// ...
wp_register_style( 'maxslider-footer', false );
wp_enqueue_style( 'maxslider-footer' );
wp_add_inline_style( 'maxslider-footer', $css );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment