I was wondering if this was a decent way of handling this function. Please take a look.
// Use Less Mixins from Theme Options to adjust Stylesheets before Parsing Less to CSS
add_filter( 'less_vars', 'wellies_less_vars', 10, 2 );
function wellies_less_vars( $vars, $handle ) {
//Necessary for UpTheme Framework
global $up_options;
//Grab Theme option and check if it's empty and default to color if it is.
$linkcolor = empty($up_options->linkcolor) ? '#08c' : $up_options->linkcolor;
$linkcolorhover = empty($up_options->linkcolorhover) ? '#03c' : $up_options->linkcolorhover;
$networknavstart = empty($up_options->networknavstartcolor) ? '#333' :$up_options->networknavstartcolor;
$networknavend = empty($up_options->networknavendcolor) ? '#222' :$up_options->networknavendcolor;
$sitenavstart = empty($up_options->sitenavstartcolor) ? '#333' :$up_options->sitenavstartcolor;
$sitenavend = empty($up_options->sitenavendcolor) ? '#222' :$up_options->sitenavendcolor;
//Set Less Mixins to Variables above
$vars = array(
'linkColor' => $linkcolor,
'linkColorHover' => $linkcolorhover,
'networkNavBarStart' => $networknavstart,
'networkNavBarEnd' => $networknavend,
'siteNavBarStart' => $sitenavstart,
'siteNavBarEnd' => $sitenavend,
);
return $vars;
}
//Enqueue Stylesheets if not on dashboard.
function wellies_css_loader() {
if ( ! is_admin() )
wp_enqueue_style('bootstrap', get_bloginfo('template_directory').'/library/css/lib/bootstrap.less', array(), '', 'screen, projection');
wp_enqueue_style('themes', get_bloginfo('template_directory').'/library/css/theme.less', array(), '', 'screen, projection');
}
add_action('wp', 'wellies_css_loader');
It is currently working but I don't want to have it slow down the site if I can optimize it somehow.