Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
$name = md5(site_url());
$name = substr($name, 0, 15);
if (!empty($_GET[$name . '-css']) == 'css') {
header('Content-Type: text/css');
$generate_settings = get_option( 'generate_settings', generate_get_defaults() );
$space = ' ';
// Start the magic
$visual_css = array (
// Body CSS
'body' => array(
'background-color' => $generate_settings['background_color'],
'color' => $generate_settings['text_color']
),
);
// Output the above CSS
$output = '';
foreach($visual_css as $k => $properties) {
if(!count($properties))
continue;
$temporary_output = $k . ' {';
$elements_added = 0;
foreach($properties as $p => $v) {
if(empty($v))
continue;
$elements_added++;
$temporary_output .= $p . ': ' . $v . '; ';
}
$temporary_output .= "}";
if($elements_added > 0)
$output .= $temporary_output;
}
$output = str_replace(array("\r", "\n"), '', $output);
echo $output;
exit;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment