Example #1
0
/**
 * Load the LESS compiler and set up Theme Customizer support.
 *
 * @since 1.0.0
 */
function audiotheme_less_setup()
{
    if ($support = get_theme_support('audiotheme-less')) {
        if (!class_exists('lessc')) {
            require AUDIOTHEME_DIR . 'includes/vendor/lessphp/lessc.inc.php';
        }
        require AUDIOTHEME_DIR . 'includes/vendor/wp-less/wp-less.php';
        wp_less::instance();
        add_action('wp_loaded', 'audiotheme_less_register_vars', 20);
        add_filter('wp_less_cache_url', 'audiotheme_less_force_ssl');
        // Register a style sheet specifically for the Theme Customizer.
        $stylesheet = empty($support[0]['customize_stylesheet']) ? '' : $support[0]['customize_stylesheet'];
        if (!empty($stylesheet)) {
            wp_register_style('audiotheme-less-customize', $stylesheet);
            add_action('wp_footer', 'audiotheme_less_customize_enqueue_stylesheet');
        }
    }
}
Example #2
0
 /**
  * Creates a new instance. Called on 'after_setup_theme'.
  * May be used to access class methods from outside.
  *
  * @see    __construct()
  * @static
  * @return \wp_less
  */
 public static function instance()
 {
     null === self::$instance and self::$instance = new self();
     return self::$instance;
 }
Example #3
0
 /**
  * Remove less vars by array key
  *
  * @param  string $name The array key of the variable to remove
  * @return void
  */
 function remove_less_var($name)
 {
     $less = wp_less::instance();
     $less->remove_var($name);
 }
Example #4
0
 /**
  * Creates a new instance. Called on 'after_setup_theme'.
  * May be used to access class methods from outside.
  *
  * @see    __construct()
  * @static
  * @return \wp_less
  */
 public static function instance()
 {
     //exit('sdfsfsdfs');
     null === self::$instance and self::$instance = new self();
     return self::$instance;
 }