Skip to content

Instantly share code, notes, and snippets.

@igmoweb
Created January 30, 2015 09:17
Show Gist options
  • Save igmoweb/672d7ec478589181c08e to your computer and use it in GitHub Desktop.
Save igmoweb/672d7ec478589181c08e to your computer and use it in GitHub Desktop.
Generate dynamic CSS
<?php
add_action( 'plugins_loaded', 'dolly_generate_css_file' );
function dolly_generate_css_file() {
if ( isset( $_GET['dolly-styles'] ) && $_GET['dolly-styles'] === 'true' ) {
header( 'Content-type: text/css' );
$options = get_option( 'dolly-options' );
?>
.mi-clase {
background:<?php echo $options['background-color']; ?>;
font-size:<?php echo $options['font-size']; ?>px;
}
<?php
exit;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment