Guest User

wp-less - lessc fix

a guest
Sep 8th, 2014
321
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.24 KB | None | 0 0
  1. /*
  2.  * ========================================================================
  3.  * WP LESS EMBEDDING
  4.  * ========================================================================
  5.  */
  6.  
  7. #require dirname(__FILE__) . '/framework/wp-less/bootstrap-for-theme.php';
  8. if ( class_exists( 'WPLessPlugin' ) and function_exists( 'ot_get_option' ) ) {
  9.  
  10.     add_action('init', 'lessc_init');
  11.  
  12.     function lessc_init() {
  13.         $less = WPLessPlugin::getInstance();
  14.  
  15.         // set the legacy configuration
  16.         $config = $less->getConfiguration();
  17.         if (!WP_DEBUG)
  18.             $config->setCompilationStrategy('legacy');
  19.  
  20.         // set some less variables
  21.         $bg = explode ( ',', get_option_tree( 'my_background' ) ) ;
  22.         $less->setVariables( array(
  23.             'primary_color'   => ot_get_option( 'primary_color', '#E7492F' ),
  24.             'secondary_color' => ot_get_option( 'secondary_color', '#649F0B' ),
  25.             'bg_color'        => empty($bg[0]) ? '#FAFAFA' : $bg[0],
  26.             'bg_image'        => empty($bg[4]) ? 'url(' . get_template_directory_uri() . '/img/diamond-pattern.png)' : "url({$bg[4]})",
  27.             'bg_repeat'       => empty($bg[1]) ? 'repeat' : $bg[1],
  28.             'bg_position'     => empty($bg[3]) ? 'left top' : $bg[3],
  29.             'bg_attachment'   => empty($bg[2]) ? 'scroll' : $bg[2]
  30.                 )
  31.         );
  32.  
  33.         $less->dispatch();
  34.     }
  35. }
Advertisement
Add Comment
Please, Sign In to add comment