twitter bootstrap 3 - How to Output Wordpress Theme Customizer changes into .less file? -


i'm trying build wordpress theme bootstrap 3 less. managed setup wordpress customizer options color changing work outputting css theme header, classic way, wondering if there way output these options .less file , compile style.css lessphp compiler, managed integrate theme , seems work when manually update less files.

right i'm outputing css head placing function functions.php:

<?php  //change colors function le_libertaire_register_theme_customizer($wp_customize) {     $colors = array();     $colors[] = array(       'slug' => 'header_text_color',        'default' => '#fff',       'label' => __('header text color', 'le-libertaire')     );     $colors[] = array(       'slug' => 'navbar_bg_color',        'default' => '#dc3023',       'label' => __('navbar bg color', 'le-libertaire')     );      foreach( $colors $color ) {       // settings       $wp_customize->add_setting(         $color['slug'], array(           'default' => $color['default'],           'type' => 'option',            'capability' =>            'edit_theme_options'         )       );       // controls       $wp_customize->add_control(         new wp_customize_color_control(           $wp_customize,           $color['slug'],            array('label' => $color['label'],            'section' => 'colors',           'settings' => $color['slug'])         )       );     } } add_action('customize_register', 'le_libertaire_register_theme_customizer');  ?> 

and code header.php:

    <?php $navbar_bg_color = get_option('navbar_bg_color'); $header_text_color = get_option('header_text_color'); ?> <style>     .navbar{background: <?php echo $navbar_bg_color ?> !important; }     .navbar-brand, .navbar-nav a{color: <?php echo $header_text_color ?> !important;} </style> 

can tell me if there way output these variables into, lets wp-customizer.less file included bootstrap.less via @import, output code in wp-customizer.less formated this

@brand-primary: #dc3023; @brand-success: #fff; color hex code replaced variable customizer output?

edit: function functions.php i'm using integrate lessphp wordpress:

    //compile less function autocompileless() {      // include lessc.inc     require_once( get_template_directory().'/less/lessc.inc.php' );      // input , output location     $inputfile = get_template_directory().'/less/bootstrap.less';     $outputfile = get_template_directory().'/style.css';      // load cache     $cachefile = $inputfile.".cache";      if (file_exists($cachefile)) {         $cache = unserialize(file_get_contents($cachefile));     } else {         $cache = $inputfile;     }      $less = new lessc;     // create new cache object, , compile     $newcache = $less->cachedcompile($cache);      // output less file, , cache file if has been modified since last compile     if (!is_array($cache) || $newcache["updated"] > $cache["updated"]) {         file_put_contents($cachefile, serialize($newcache));         file_put_contents($outputfile, $newcache['compiled']);     } }  if(is_admin()) {     add_action('init', 'autocompileless'); } 

is there way pass variables created customizer lessphp , output them file named wp-customizer.less?


Comments

Popular posts from this blog

python - No exponential form of the z-axis in matplotlib-3D-plots -

php - Best Light server (Linux + Web server + Database) for Raspberry Pi -

c# - "Newtonsoft.Json.JsonSerializationException unable to find constructor to use for types" error when deserializing class -