Beispiel #1
0
/**
 * Generate CSS styles in head section
 * @global Kleo $kleo_theme
 */
function kleo_custom_head_css()
{
    global $kleo_theme;
    $dynamic_css = get_template_directory() . '/assets/css/dynamic.php';
    echo "\n<style>";
    ob_start();
    // Capture all output (output buffering)
    //add fonts styles
    add_filter('kleo_add_dynamic_style', array($kleo_theme, 'add_font_css'));
    require $dynamic_css;
    // Generate CSS
    $css = ob_get_clean();
    // Get generated CSS
    echo kleo_compress($css);
    echo '</style>';
}
Beispiel #2
0
 function kleo_generate_dynamic_css()
 {
     global $kleo_config;
     $dynamic_css = get_template_directory() . '/assets/css/dynamic.php';
     ob_start();
     // Capture all output (output buffering)
     require $dynamic_css;
     // Generate CSS
     $css = ob_get_clean();
     // Get generated CSS (output buffering)
     $css = kleo_compress($css);
     if (!is_dir($kleo_config['custom_style_path'])) {
         // dir doesn't exist, make it
         mkdir($kleo_config['custom_style_path']);
     }
     file_put_contents(trailingslashit($kleo_config['custom_style_path']) . 'dynamic.css', $css, LOCK_EX);
     // Save it
 }