Skip to content

Instantly share code, notes, and snippets.

@BoweFrankema
Last active August 29, 2015 13:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save BoweFrankema/10998747 to your computer and use it in GitHub Desktop.
Save BoweFrankema/10998747 to your computer and use it in GitHub Desktop.
Titan Framework and LESS Variables
<?php
/**
* Pass variables from Titan Option to WP-LESS. This seems tricky.
*/
function cf_theme_variables()
{
if (class_exists('WPLessPlugin')){
$titan = TitanFramework::getInstance( 'cfcommunity-roots' );
$less = WPLessPlugin::getInstance();
$primary_brand = $titan->getOption( 'my_text_option' );
$less->addVariable('custom-brand-primary', $primary_brand);
// you can now use @myColor in your *.less files
// you can now use @minSize in your *.less files
// @myColor value has been updated to #777
}
}
add_action( 'plugins_loaded', 'cf_theme_variables' );
?>
Current error:
Fatal error: Uncaught exception 'Less_Exception_Compiler'
with message 'variable @custom-brand-primary is undefined' in
lib/vendor/wp-less/lib/vendor/less.php/lib/Less/Tree/Variable.php:48 S
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment