PHP code example of icit / wp-less

1. Go to this page and download the library: Download icit/wp-less library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

icit / wp-less example snippets




// Include the class (unless you are using the script as a plugin)
 'style', get_stylesheet_directory_uri() . '/style.less' );

// you can also use .less files as mce editor style sheets
add_editor_style( 'editor-style.less' );




// pass variables into all .less files
add_filter( 'less_vars', 'my_less_vars', 10, 2 );
function my_less_vars( $vars, $handle ) {
    // $handle is a reference to the handle used with wp_enqueue_style()
    $vars[ 'color' ] = '#000000';
    return $vars;
}


register_less_function( 'double', function( $args ) {
    list( $type, $value, $unit ) = $args;
	return array( $type, $value*2, $unit );
} );

unregister_less_function( 'double' );

add_less_var( 'brandcolour', '#ec6704' );

remove_less_var( 'brandcolour' );